File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get Connection from ConnectionPool

 
sai prasanna
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

How to get an Connection from an Connnection Pool is the following code correct.
Connection con=null;
con = ds.getConnection();

thanks in advance
saiprasanna.
 
Wei Dai
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ConnectionPoolDataSource ds;
//...
PooledConnection con=ds.getPooledConnection();
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sai prasanna , you code is true in case that your datasource works ok , do not forget that you must close the connection after your job finished with the connection.



What Wei Dai said , must looks like the following one to works.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic