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?