Hello,
I would like to ask which way of using JDBC code in one servlet is better:
1)
Connection con = pool.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query1);
...
rs.close();
...
rs = stmt.executeQuery(query2);
...
rs.close();
...
rs = stmt.executeQuery(query3);
...
rs.close();
stmt.close();
pool.closeConnection();
2)
Connection con = pool.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query1);
...
rs.close();
stmt.close();
pool.closeConnection();
...
con = pool.getConnection();
stmt = con.createStatement();
rs = stmt.executeQuery(query2);
...
rs.close();
stmt.close();
pool.closeConnection();
...
con = pool.getConnection();
stmt = con.createStatement();
rs = stmt.executeQuery(query3);
...
rs.close();
stmt.close();
pool.closeConnection();
Does anybody have expriences with that and can provide some comparation?
Thanks.
Filip
http://BrainKing.com
http://BrainKing.info
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus