Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Native Client not disconnecting?

Author  Topic 

antik
Starting Member

1 Post

Posted - 2008-12-23 : 11:16:28
I'm writing a C++ application that leverages SQL Native Client (v. 2005.90.3042.00) to communicate with SQL Server 2000. I've noticed two issues that may be related, may not be.

My application abstracts database connections into an object. The object is connected when created and terminated when the object is destroyed. I know I'm destroying the objects as their destructor is being called. Inside the destructor, SQLDisconnect( ConnHandle ); is called (returns a successful value) and then SQLFreeHandle( SQL_HANDLE_DBC, ConnHandle ); This object is used frequently but connects to the same database repeatedly.

My problem is that sp_Who2 doesn't indicate the connection as disconnecting: nor does the Performance Monitor. This is problematic because some circumstances literally spawn several thousands of my connection object over time and it seems to be eventually creating issues spawning connections, etc.

Connection pooling is not enabled. Furthermore, when I do enable pooling, my application (and my unit test rig) blow up when SQLDriveConnect is called more than once (it blows up when SQLDriverConnect is called a second time, not the first, in this instance.)

What should I look into to understand why my connections do not seem to be terminating or pooling?


   

- Advertisement -