Why am I getting "Data source name not found and no default driver specified" and how do I fix it?

What causes this error?

The error message tells you, simply put, that the ODBC Driver Manager could not find the driver you specified in your connection string or DSN.

This can have 3 common causes:

  1. The driver you tried to use is not installed on your system
  2. The driver is installed, however, it doesn't match bitness of the code you're running
  3. You made an error in typing the driver name

How do I check which drivers are installed on my system?

You can check the drivers which are installed on your system by going to the ODBC Data Source Administrator. To open it, press ⊞ Win + R, and type in: odbcad32.exe. Then check the tab Drivers for installed drivers. The Name column indicates the exact name you should use in your connection string or DSN.

If you're on 64-bit Windows, that only lists the 64-bit drivers installed on your system. To see which 32-bit drivers are installed, press press ⊞ Win + R, and type in: C:\Windows\SysWOW64\odbcad32.exe, and go to the Drivers tab again.

enter image description here

The driver is installed, but it might be the wrong bitness, what do I do?

Then, you have two choices, either adjust the bitness your program is running in, or install a driver with a different bitness.

Some of the drivers that are installed by default on Windows only have a 32-bits variant. These can't be used with 64-bits programs.

You can usually identify which bitness a program is running under in task manager. In Windows 10, all 32-bit programs have (32-bit) appended to their name. If that isn't there, you're likely running a 64-bit program, and most modern programming languages and environments run on 64-bit by default, but allow you to switch to 32-bit. However, the specifics for different programming languages are outside the scope of this question.

How can I verify I didn't mistype the driver name?

An ODBC connection string looks like this:

DRIVER={DriverName};ParameterName1=ParameterValue1;ParameterNameN=ParameterValueN;

The driver name part needs to be delimited by curly braces if it might contain special characters, and needs to exactly match the installed driver name, as found in the ODBC Data Source Administrator, including spaces and typographical characters, but excluding capitalization.

Note that for deployed code, the driver must be present on the computer/server running the code.

I don't have the driver, or have the wrong bitness, where do I get the right one?

That depends on which driver you want to use.

A list of common drivers with download locations (all 32-bit and 64-bit at the same URL):

  • The Microsoft ODBC Driver 17 for SQL Server
  • The Microsoft Access database driver, which is part of the Microsoft Access Database Engine. Note that simultaneous installations of 32-bit and 64-bit Access ODBC drivers are not supported.
  • The MySQL ODBC connector by Oracle
  • The open-source SQLite ODBC driver by Christian Werner (non-official)
  • psqlODBC, the official PostgreSQL driver

If the driver you want to use isn't listed, the location is usually easily found using Google.