Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 312495 - Last Review: October 12, 2005 - Revision: 4.4
FIX: SQLManageDataSources Fails When Connection Pooling Is Turned On at Process Level
This article was previously published under Q312495
When you turn on connection pooling at the process level and call the
SQLManageDataSources function to configure a file data source name (DSN), you may receive the following error:
General error: Invalid file dsn 'C:\Program Files\Common Files\ODBC\Data Sources\XXX.dsn'
When used to configure a file DSN,
SQLManageDataSources internally creates a connection handle (SQLHDBC handle) and calls the
SQLDriverConnect function with the SQL_DRIVER_PROMPT option. The SQL_DRIVER_PROMPT option is not supported with
SQLDriverConnect when connection pooling is turned on.
MDAC 2.7
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next MDAC service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:
NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
The English version of this fix should have the following file attributes or later:
Date Version Size File name Platform
-----------------------------------------------------------
20-Nov-2001 3.520.8120.0 200,704 Odbc32.dll x86
To work around this problem, either turn off connection pooling or turn on connection pooling using an environment handle (SQLHENV). Do not turn on connection pooling at the process level.
For example, the following code works properly:
SQLHENV hEnv;
SQLAllocHandle(SQL_HANDLE_ENV, NULL, &hEnv);
SQLSetEnvAttr(hEnv,SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_NTS);
Note that an environment handle is passed as the first argument rather than SQL_NULL_HENV. A value of SQL_NULL_HENV for the first argument turns on connection pooling process-wide.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Steps to Reproduce Behavior
-
To turn on connection pooling at the process level, call the following function with the first parameter (the environmental handle) set to NULL:
SQLSetEnvAttr(SQL_NULL_HENV,SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_DRIVER, SQL_NTS);
-or-
SQLSetEnvAttr(SQL_NULL_HENV,SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_NTS);
-
Call SQLManageDataSources, passing a valid window handle as a parameter.
- Configure a file DSN.
APPLIES TO
- Microsoft Data Access Components 2.7
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.6 Service Pack 1
- Microsoft Data Access Components 2.6 Service Pack 2
| kbhotfixserver kbqfe kbbug kbprb kbqfe KB312495 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate