File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URGENT !!! DATABASE POOLING

 
Lalu George
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please give me some reply
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic