aspose file tools*
The moose likes JDBC and the fly likes URGENT !!! DATABASE POOLING Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "URGENT !!! DATABASE POOLING" Watch "URGENT !!! DATABASE POOLING" New topic
Author

URGENT !!! DATABASE POOLING

Lalu George
Greenhorn

Joined: Dec 25, 2002
Posts: 9
I've just configured database pooling in tomcat 4.1 JDK1.4 LE using commons-DBCP and it is working fine. Earlier i was using bitmechanic pooling mechanism in my application. Here comes my problem in my code i was using the same connection object for creating more than one prepared statment objects and it was working fine. say
Connection con = null;
PreparedStatement pst = null;
con= new DB().getConnection();
pst = con.createPreparedStatement("<FIRST SQL QUERY COMES HERE>");
rs = con.executeQuery();
pst.close();

pst = con.createPreparedStatement("<SECOND SQL QUERY COMES HERE>");
con.executeUpdate();
pst.close();
With bitmechanic i was able to do this wiht the above code but when i implemeted the pooling using commons-DBCP i started getting a Connection closed SQLException, but this error goes when i call another
DB Connection ( con= new DB().getConnection() just before creating the second statement. Why is this thing happening, is it b'cos the DBCP automaitcally closes the conneciton and return backs it to its pool. Is there any other efficient method for implementing this.
Thanks in advance
Lalu George
Lalu George
Greenhorn

Joined: Dec 25, 2002
Posts: 9
Please give me some reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URGENT !!! DATABASE POOLING