Meilleur auteur de réponses

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified IM002

Question

I am using VS2010 C++ to complie and run a console app to connected with local installed SQLEXPRESS database. while I use control panel ODBC data souce check the connection , I have no problem at all and I can also use SQL server management
studio to connect database, but while I run the program, I always get [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified IM002 error.

I have tried all suggestion from previous posting, check SQL native client installation, reinstall SQL EXPRESS, non of them help me, can any help me out?

Réponses

Could you please post the full text error message here? It seems that it is a 5701 message, which indicates that SQL Server initially puts the user’s context into the target database specified on the connection string. It can be purely informational, and the
application can ignore that. For more information, please refer to this KB article:
INF: ODBC Messages on SQL Server Connections.

In addition, if you want to use SQL Server Native Client as the provider, you may need to use ‘SQL Server Native Client’ (SQL Server 2005) or ‘SQL Server Native Client 10.0’ (SQL Server 2008 or R2) as the driver on your connection string. Please see:
Using the SQL Server Native Client Header and Library Files.

Could you please post the full text error message here? It seems that it is a 5701 message, which indicates that SQL Server initially puts the user’s context into the target database specified on the connection string. It can be purely informational, and the
application can ignore that. For more information, please refer to this KB article:
INF: ODBC Messages on SQL Server Connections.

In addition, if you want to use SQL Server Native Client as the provider, you may need to use ‘SQL Server Native Client’ (SQL Server 2005) or ‘SQL Server Native Client 10.0’ (SQL Server 2008 or R2) as the driver on your connection string. Please see:
Using the SQL Server Native Client Header and Library Files.

The full text error is like this 0100, [Microsoft]{ODBC SQL Server Driver][SQL Server]Changed database context to 'NewDB'. I think you are right this is just pure information because I can still get further SQL database operation done such as the query.