aspose file tools*
The moose likes Websphere and the fly likes Connection Pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Connection Pooling" Watch "Connection Pooling" New topic
Author

Connection Pooling

Mike Muschal
Greenhorn

Joined: Jun 07, 2001
Posts: 5
Is it possible to implement connection pooling in WebSphere without Java code? An application that I'm about to inherit performs a getConnection to the database in 23 different JSPs, and will be accessible to several hundred users. When I asked the developer to consider connection pooling, he showed me on the WebSphere Administration Console that they had set Max Connections to 25 on the ServletEngine (and therefore that connection pooling was in place). He's the pro, but I have my doubts that he's right on this one.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Originally posted by Mike Muschal:
Is it possible to implement connection pooling in WebSphere without Java code? An application that I'm about to inherit performs a getConnection to the database in 23 different JSPs, and will be accessible to several hundred users. When I asked the developer to consider connection pooling, he showed me on the WebSphere Administration Console that they had set Max Connections to 25 on the ServletEngine (and therefore that connection pooling was in place). He's the pro, but I have my doubts that he's right on this one.

If he really and truly believes that all you have to do to get connection pooling in WebSphere is to set the connections size in the admin console, he's not a pro, he's a dunce (and a dangerous one at that). However, my guess is that this is not what he meant.
WebSphere connection pooling (at least in WAS 3.5 and 4.0) is based around the DataSource class. To use WebSphere connection pooling you have to first look up a DataSource from a JNDI InitialContext, and then send "getConnection()" to the DataSource to get the connection.
The alternative is to use the javax.sql.DriverManager class to obtain your connections directly from the JDBC driver -- this does NOT use connection pooling and should NEVER be done in WebSphere (unless you are, perhaps, using a database not supported by the WebSphere connection pooling implementation).
Kyle
[ September 18, 2002: Message edited by: Kyle Brown ]

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Thembile Mzantsi
Ranch Hand

Joined: Aug 06, 2002
Posts: 58
Technically, he does not have to write code for connection pooling itself. The driver providers/websphere write this code for us. All we need to do is to set it up. As Kyle points out though, the rest of the code (the developer's code) simply has to obtain this provided datasource implementation via JNDI and use the DataSource which encapsulates the connection pool.
I am assuming that they did setup the Datasource in WAS.
-t
Mike Muschal
Greenhorn

Joined: Jun 07, 2001
Posts: 5
My thanks to both of the responders. The code was in fact missing to use connection pooling. The developer thought that setting up the DataSource was the extent of using it. He did a little searching after my inquiry and found that more work was needed.
I appreciate this site a whole bunch. You guys are very helpful. I hope I can start answering questions soon myself.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Connection Pooling