wood burning stoves 2.0*
The moose likes JDBC and the fly likes get Connection from ConnectionPool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "get Connection from ConnectionPool" Watch "get Connection from ConnectionPool" New topic
Author

get Connection from ConnectionPool

sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
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

Joined: Jun 22, 2005
Posts: 86
ConnectionPoolDataSource ds;
//...
PooledConnection con=ds.getPooledConnection();
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

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.



Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get Connection from ConnectionPool