ODBC – Error – “Error :(‘IM002’, [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified)”

Error

Error Image

DataSourceNameNotFoundAndNoDefaultDrrverSpecified.02.20191205.0130PM.png

Error Text


Error :('IM002', [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified)
(SQLDriverConnect)

Source Code

Python

Outline

  1. Prepare ODBC Connection String
  2. Pass ODBC Connection String to module pyodbc, connect method

Code


connstrng="DRIVER={ODBC Driver 10 for SQL Server};SERVER=test;DATABASE=test;UID=user;PWD=password"

conn =pyodbc.connect(connstring)

TroubleShooting

ODBC

ODBC Manager

Issued ODBC Manager (%windir%\syswow64\odbcad32.exe) and reviewed the list of ODBC Drivers

Image

odbcManager_01_20191205_0140PM.png

Explanation

Noticed that the following ODBC Drivers are listed for SQL Server :-

  1. ODBC Driver 13 for SQL Server
    • Version
      • 2017.140.1000.169

 

Source Code ( Revised )

Python

Outline

  1. Driver
    • Original
      • DRIVER={ODBC Driver 10 for SQL Server}
    • Revised
        • DRIVER={ODBC Driver 13 for SQL Server}

 

Code


connstrng="DRIVER={ODBC Driver 13 for SQL Server};SERVER=test;DATABASE=test;UID=user;PWD=password"

conn =pyodbc.connect(connstring)

Summary

Post a client machine upgrade the ODBC Version had changed from ODBC v10 to v13.

The change in the loaded ODBC Driver meant that applications that explicitly references ODBC Drivers by version would fail.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s