It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes MS SQL -- JDBC -- Memory Spike -- HELP! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "MS SQL -- JDBC -- Memory Spike -- HELP!" Watch "MS SQL -- JDBC -- Memory Spike -- HELP!" New topic

MS SQL -- JDBC -- Memory Spike -- HELP!

BrianD Clay

Joined: Sep 17, 2004
Posts: 1
Here is the overview of the problem.

We are using WAS5.1, MS SQL with the SP3 JDBC drivers (though we were having the same problem with SP1 and SP2).

When testing our web application and running transactions that make calls through the pooled Datasource to SQL that causes an increase in SQL memory usuage. Which to a certain degree in understandable. What happens though is the memory usuage keeps increasing; as if the JDBC driver is not releasing the transaction even though we are closing Result Sets, Statements, clearing warnings, and closing the connection. We are 99.9% certain that on the Java side connections are being cleaned up and closed. Yet the memory keeps disappearing.

Has anyone else experienced this and/or found a solution to it. I feel like I am missing a configuration somewhere.


Brian D. Clay
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

We've had nothing but problems with MS's own drivers - they are just not very good. Try jTds. Its a little better. However - we have yet to find anything that seems good enough for our production system other than a commercial driver (Data Direct).
[ September 20, 2004: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Prashant Jain

Joined: Aug 19, 2004
Posts: 29
Hi Brian!

I have this information to share with you. It just might help you. Take a look at this code.

Connection conn = getConnection();
CallableStatement cal1 = conn.prepare(//something);
CallableStatement cal2 = conn.prepare(//something);

What the MS Driver does is, that even though you are preparing two statements and using the same connection, it will implicitly open one more connection.And it will go on doing this for every statement.So while you close one connection,I wonder whats happening to the other ones!

You may want to verify this at SQL server end by using
exec sp_who

This is one reason why we decided not to use MS driver and went in for DataDirect. There are lots of drivers available for this.jTds is open source.

Prashant Jain
I agree. Here's the link:
subject: MS SQL -- JDBC -- Memory Spike -- HELP!
It's not a secret anymore!