File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes suggestion for DB pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "suggestion for DB pool" Watch "suggestion for DB pool" New topic
Author

suggestion for DB pool

Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
Any suggestions for existing JDBC pool code I can use direcly?

I found one in http://java.sun.com/developer/onlineTraining/Programming/JDCBook/conpool.html

Is this is good enough or you would like to recommend other one.

Thanks,

David
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
What's wrong with javax.sql.ConnectionPoolDataSource and javax.sql.PooledConnection?

I understand that these have been part of the J2SE Platform since 1.4.

I'm no expert, however. :roll:

Jules
Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
I assume javax.sql.ConnectionPoolDataSource and javax.sql.PooledConnection are only interface and no implemented class available yet. So I need to implement those interface to get connection pool?

Correct me if I am wrong, I have n't worked on DB connection pool before.

Thanks

David



What's wrong with javax.sql.ConnectionPoolDataSource and javax.sql.PooledConnection?

I understand that these have been part of the J2SE Platform since 1.4.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi David,

java.sql.Connection is an interface too, but that doesn't stop you using it!

Implementations of these interfaces are what make up the JDBC driver software (it's not just the Driver class). You will need a driver for your chosen database that supports these optional JDBC 2.0 features.

Jules
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by Julian Kennedy:
What's wrong with javax.sql.ConnectionPoolDataSource and javax.sql.PooledConnection?
One thing that is wrong with them is that they are infrastructure classes for connection pools - they (or rather, their implementations) do not implement a connection pool themselves.

What context do you need a connection pool in? Every application server has one on board, so if you're in a web or EJB environment all you have to do is configure your data source in the app server and look up the DataSource it creates. Otherwise, try Apache Jakarta Commons DBCP.

- Peter
[ August 09, 2004: Message edited by: Peter den Haan ]
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Here is a link to a db-connection-pooling software.
I didn't try it myself, but from knowing the developer from another forum, he seems to be able to solve such a job:

Free Database Connection Pooling Software
http://www.primrose.org.uk

[ August 06, 2004: Message edited by: Stefan Wagner ]

http://home.arcor.de/hirnstrom/bewerbung
Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
Thanks for your comments, Jules.

Could you point me the sample link or code with the use of javax.sql.ConnectionPoolDataSource and javax.sql.PooledConnection?

Thanks,


Implementations of these interfaces are what make up the JDBC driver software (it's not just the Driver class). You will need a driver for your chosen database that supports these optional JDBC 2.0 features.

Jules
Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
I hope to create the DB connection to Oracle, no Web or EJB enciroment. so shoudl I use OracleConnectionPoolDataSource as http://www.exciton.cs.rice.edu/JavaResources/Oracle/oracle/jdbc/pool/OracleConnectionPoolDataSource.html for connection pool?


What context do you need a connection pool in? Every application server has one on board, so if you're in a web or EJB environment all you have to do is configure your data source in the app server and look up the DataSource it creates
[ August 06, 2004: Message edited by: David Meng ]
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi David,

I suggest that you take the recommendations from Peter and Stefan. I appear to have overreached the extent of my knowledge on this one.

Jules
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by David Meng:
so shoudl I use OracleConnectionPoolDataSource [...]?
No, it doesn't do what you want. Use the Jakarta DBCP I referred to; Primrose looks like it has a nice feature set but it is probably overkill, those features can only get in the way.

- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: suggestion for DB pool