views:

303

answers:

2

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

Before doing any database work, I allocate an environment handle as follows:

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

This completes successfully.

To enable connection 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 included, returns a good code, indicating success. However, it causes my application to crash the second time that SQLDriverConnect is called to establish a connection to the database (note: the first connection will have been created using SQLDriverConnect and disconnected using SQLDisconnect by this time.) If I comment this line out, the application proceeds without trouble.

What might be causing this?

+1  A: 

Are you by any chance experiencing the same problem that this person was having: http://www.mydatabasesupport.com/forums/ms-sqlserver/218008-2003-cluster-sql-2000-connection-pooling-causes-crash.html

Michel
A: 

This could be completely different problem (i.e. I don't use C++) , but maybe it helps you.

Application which I am working on also crashed when I turned pooling on.

The problem occurred when database query returned more than one record set.

My app crashed when I tried to move to the next record set.

This is something different, but could be related to your case.

Grzegorz Gierlik