aspose file tools*
The moose likes JDBC and the fly likes connection pooling using directcoonection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connection pooling using directcoonection problem" Watch "connection pooling using directcoonection problem" New topic
Author

connection pooling using directcoonection problem

swapnil paranjape
Ranch Hand

Joined: May 15, 2005
Posts: 126
hi
i am working on code which makes direct connection with database using driver manager class and stores this connections in arraylist as connection object and thus make a pool of connection which is used in program

now ,once the connection is used ,it should be realsed and make available for further release.

so what check needs to be done to ensure that connection is released.

also coonection pooling code works fine on weblogic but doesnt run on websphere ,what can be the possible cause?

is the approach for connection pooling right? and what can be reason for code,not to run on websphere
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Swapnil,
A more traditional approach would be to use a connection pooling driver. That way the application server can handle the connections for you.

The next best thing is to use a connection pooling library like the one in Apache Commons.

If you really have to write your own, check that all of the code is releasing connections. Also, check you clean out the pool every so often of stale connections.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
swapnil paranjape
Ranch Hand

Joined: May 15, 2005
Posts: 126
hi,
thanx for the help..but existing code i am working on uses this kind of connection pooling where pool of direct connection is stored in the arraylist

this code works fine in tomcat but gives not enough connection in websphere

actually when there are not enough connection then i am running a thread which will create more direct connection ...which will in a way help for getting connections.


as you have mentioned clean the pool for stale connection...how should i do that
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

One approach is to have a thread that goes through the pool every so often to see if the connections are closed. This won't get all of the stale connections, but it will get some.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connection pooling using directcoonection problem