/** * */ package testsuite.simple; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Properties; import testsuite.BaseTestCase; /** * @author Administrator * */ public class TestBug42929 extends BaseTestCase { /** * @param name */ public TestBug42929(String name) { super(name); // TODO Auto-generated constructor stub } public void testBug42929() throws Exception { System.out.println("java.vm.version : " + System.getProperty("java.vm.version")); System.out.println("java.vm.vendor : " + System.getProperty("java.vm.vendor")); System.out.println("java.runtime.version : " + System.getProperty("java.runtime.version")); System.out.println("os.name : " + System.getProperty("os.name")); System.out.println("os.version : " + System.getProperty("os.version ")); System.out.println("sun.management.compiler : " + System.getProperty("sun.management.compiler")); try { if (versionMeetsMinimum(5, 0, 7)) { Properties props = new Properties(); props.put("useCursorFetch","true"); props.put("defaultFetchSize","100"); props.put("useServerPrepStmts","true"); props.put("clobberStreamingResults","true"); //props.put("connectTimeout","500"); //props.put("socketTimeout","300"); Connection conn1 = null; try { conn1 = getConnectionWithProps(props); for (int testSize = 100; testSize <= 1000000; testSize *= 100) { java.sql.Statement ds = conn1.createStatement(); ds.execute("DROP TABLE IF EXISTS bug42929"); ds.execute("CREATE TABLE bug42929 (fid INT UNSIGNED not null primary key, name varchar(255))"); PreparedStatement insert = conn1.prepareStatement("insert into bug42929(fid) values (?)"); System.out.println("start insert"); for (int i = 0; i < testSize; i++) { insert.setInt(1, i); insert.execute(); //System.out.print("."); } System.out.println("done insert"); insert.close(); ds.close(); PreparedStatement getDiscovered2 = conn1.prepareStatement("SELECT fid FROM bug42929"); getDiscovered2.setFetchSize(Integer.MIN_VALUE); ResultSet rs1 = getDiscovered2.executeQuery(); int i = 0; System.out.println("start select"); while (rs1.next() && i < 100) { i++; } System.out.println("done select"); long start = System.currentTimeMillis(); // start timing rs1.close(); long end = System.currentTimeMillis(); // start timing System.out.println("took: " + (end - start)); getDiscovered2.close(); } conn1.close(); } finally { if (conn1 != null) { conn1.close(); } } } } finally { closeMemberJDBCResources(); } } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub junit.textui.TestRunner.run(TestBug42929.class); } }