Internal SQL client crashes when second connection is opened on connection pool connection?

I am working with a C ++ application that uses SQL Native Client to communicate via ODBC to a SQL Server 2000 database.

Before doing any work on the database, I allocate the environment handle like this:

retcode = SQLAllocHandle( SQL_HANDLE_ENV, SQL_NULL_HANDLE, &EnvironmentHandle );


This completes successfully.

To enable pooling, BEFORE the above statement, I call:

retcode = SQLSetEnvAttr( NULL, SQL_ATTR_CONNECTION_POOLING, (SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_IS_INTEGER );

SQLSetEnvAttr

when enabled returns nice code indicating success. However, this causes my application to crash the second time it SQLDriverConnect

is called to establish a database connection (note: the first connection will be created with SQLDriverConnect

and disconnected with by SQLDisconnect

this time.) If I comment out this line, the application leaks without problems.

What could be causing this?

0


source to share


2 answers


You are accidentally experiencing the same problem as this person: http://www.mydatabasesupport.com/forums/ms-sqlserver/218008-2003-cluster-sql-2000-connection-pooling-causes-crash.html



+1


source


It might be a completely different problem (i.e. I'm not using C ++), but maybe this will help you.

The app I am working on also crashed when I enabled the pool.

The problem arose when a database query returned more than one recordset.



My app crashed when I tried to navigate to the next set of records.

This is something else, but may be related to your case.

0


source







All Articles