protected long test(DataSource ds, int n) throws Exception { long start; long end; start = System.currentTimeMillis(); for (int i = 0; i < n; ++i) { Connection con = null; try { con = ds.getConnection(); } finally { ConnectionUtils.attemptClose( con ); } //System.err.print(i + "\t"); } end = System.currentTimeMillis(); return end - start; } }
protected long test(DataSource ds, int n) throws Exception { long start; long end; start = System.currentTimeMillis(); for (int i = 0; i < n; ++i) { Connection con = null; try { con = ds.getConnection(); } finally { ConnectionUtils.attemptClose( con ); } //System.err.print(i + "\t"); } end = System.currentTimeMillis(); return end - start; } }
protected long test(DataSource ds, int n) throws SQLException { Connection con = null; try { con = ds.getConnection(); return test( con , n ); } finally { ConnectionUtils.attemptClose( con ); } //{} }
protected long test(DataSource ds, int n) throws SQLException { Connection con = null; try { con = ds.getConnection(); return test( con , n ); } finally { ConnectionUtils.attemptClose( con ); } //{} }
static void drop(DataSource ds) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); stmt.executeUpdate("DROP TABLE TRSS_TABLE"); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
static void drop(DataSource ds) throws SQLException { Connection con = null; PreparedStatement ps1 = null; try { con = ds.getConnection(); ps1 = con.prepareStatement(EMPTY_TABLE_DROP); ps1.executeUpdate(); } finally { StatementUtils.attemptClose( ps1 ); ConnectionUtils.attemptClose( con ); } System.err.println("Test schema dropped."); } }
static void create(DataSource ds) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); stmt.executeUpdate("CREATE TABLE TRSS_TABLE ( a_col VARCHAR(16) )"); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
static void create(DataSource ds) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); stmt.executeUpdate("CREATE TABLE TRSS_TABLE ( a_col VARCHAR(16) )"); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
static void create(DataSource ds) throws SQLException { System.err.println("Creating test schema."); Connection con = null; PreparedStatement ps1 = null; try { con = ds.getConnection(); ps1 = con.prepareStatement(EMPTY_TABLE_CREATE); ps1.executeUpdate(); System.err.println("Test schema created."); } finally { StatementUtils.attemptClose( ps1 ); ConnectionUtils.attemptClose( con ); } }
static void drop(DataSource ds) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); stmt.executeUpdate("DROP TABLE TRSS_TABLE"); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
static void create(DataSource ds) throws SQLException { System.err.println("Creating test schema."); Connection con = null; PreparedStatement ps1 = null; try { con = ds.getConnection(); ps1 = con.prepareStatement(EMPTY_TABLE_CREATE); ps1.executeUpdate(); System.err.println("Test schema created."); } finally { StatementUtils.attemptClose( ps1 ); ConnectionUtils.attemptClose( con ); } }
static void doSomething(DataSource ds) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int i = stmt.executeUpdate("INSERT INTO TRSS_TABLE VALUES ('" + System.currentTimeMillis() + "')"); if (i != 1) throw new SQLException("Insert failed somehow strange!"); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
static void create(DataSource ds) throws SQLException { System.err.println("Creating test schema."); Connection con = null; PreparedStatement ps1 = null; try { con = ds.getConnection(); ps1 = con.prepareStatement(EMPTY_TABLE_CREATE); ps1.executeUpdate(); System.err.println("Test schema created."); } finally { StatementUtils.attemptClose( ps1 ); ConnectionUtils.attemptClose( con ); } }
static void drop(DataSource ds) throws SQLException { Connection con = null; PreparedStatement ps1 = null; try { con = ds.getConnection(); ps1 = con.prepareStatement(EMPTY_TABLE_DROP); ps1.executeUpdate(); } finally { StatementUtils.attemptClose( ps1 ); ConnectionUtils.attemptClose( con ); } System.err.println("Test schema dropped."); } }
static void doSomething(DataSource ds) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int i = stmt.executeUpdate("INSERT INTO TRSS_TABLE VALUES ('" + System.currentTimeMillis() + "')"); if (i != 1) throw new SQLException("Insert failed somehow strange!"); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
static void drop(DataSource ds) throws SQLException { Connection con = null; PreparedStatement ps1 = null; try { con = ds.getConnection(); ps1 = con.prepareStatement(EMPTY_TABLE_DROP); ps1.executeUpdate(); } finally { StatementUtils.attemptClose( ps1 ); ConnectionUtils.attemptClose( con ); } System.err.println("Test schema dropped."); } }
protected long test(DataSource ds, int n) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); //System.err.println( stmt.getClass().getName() ); return test( stmt , n ); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
protected long test(DataSource ds, int n) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); //System.err.println( stmt.getClass().getName() ); return test( stmt , n ); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
protected long test(DataSource ds, int n) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); return test( con , n ); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }
protected long test(DataSource ds, int n) throws SQLException { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); return test( con , n ); } finally { StatementUtils.attemptClose( stmt ); ConnectionUtils.attemptClose( con ); } }