Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pooled Connections

 
Alex Yip
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm using an Oracle datasource in my app. I get the datasource through an InitialContext.lookup. Is there a way I can do connection pooling? I've never done any connection pooling before. I've looked online everywhere and can't seem to find a good tutorial or explaination on it. I'm trying to use ConnectionPoolDataSource, but it turns out to be an interface. Any help would be appreciated.

Thanks!
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What application server are you using? Tomcat 5.5.x includes DBCP that handles connection pooling for you.
 
Alex Yip
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Oracle 10g AS. Are their differences depending on which application server you use?
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know much about the Oracle app server. But I think that it implements that full J2EE standard which includes a way to have ConnectionPoolDataSource. You would never create one of these yourself. The application server should give you a way to get at it, most often via JNDI.

I know that WebLogic, for example, has the ability to configure a pooled data source through the administration console. You give it all of the information and the datasource becomes available via JNDI. I would guess that the Oracle app server has a similar concept.
 
Alex Yip
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Scott! Forgive me for asking stupid questions. I'm a junior developer getting into the world of Java Programming. So are you saying that connection pooling is tied to the application server? I'm a little confused, I thought connection pooling was done on the application using something like javax.sql.PooledConnection and javax.sql.ConnectionPoolDataSource.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alex,
If you are writing a threaded application, you would use a Java library for connection pooling.

On an application server, you let the server handle it. The idea of a DataSource is that you don't have to have any knowledge of what kind of connection you have. So you don't want to have to cheange the code for connection pooling.

Most database vendors provide a connection pooling driver that you can have Oracle App Server use.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic