Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

suggestion for DB pool

 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic