EJB design: Connection Pooling leads to unlimited Connetions in SQL server
Connection pooling in Sun Application Server leads to create unlimited connections in my sql server,help.
- Posted by: Debmalya Bhattacharya
- Posted on: December 21 2004 05:13 EST
How to count no. of object in each pool?
how to delete objects from a connection pool ?
- Make sure you use correctly try/finally pattern by Ruslan Zenin on December 22 2004 03:24 EST
- Connection Pooling leads to unlimited Connetions in SQL server by Jon L Schuck on December 22 2004 11:51 EST
- Connection Pooling leads to unlimited Connetions in SQL server by Jon L Schuck on December 22 2004 11:55 EST
Are u sure you are correctly disposing your connections.
You have to follow this principle:
void myMethod(DataSource ds) throws SQLException
Connection conn = ds.getConnection();
// do something...
Notice that ONLY when connection is successfully retrieved from the DataSource your code enters into TRY/FINALLY block and no matter what happens in your code, FINALLY block is always called and connection is closed (e.g. returned to the connection pool...
To aid your code review, I reccomend "HAMMURAPI" Java code review tool. It has code instectors that check if you are correctly handle connections and other resources.
Here is the link: http://www.hammurapi.org
If you are using EJB's and transactions, resource such as Connections/Statements won't be released until the transaction is either committed or rolled back. If you don't need transactions on your EJB's use never or not supported. And, as always, make sure you close your Connection/ResultSet/Statement Objects in a finally clause.
Hope this helps -
Oh, you can use the asadmin utility and monitoring to determine the number of open connections in the connection pool.