Skip to content Skip to sidebar Skip to footer

Pyodbc.error: ('im002', '[im002] [unixodbc][driver Manager]data Source Name Not Found, And No Default Driver Specified (0) (sqldriverconnect)')

I am trying to connect to a datbase using pyodbc and running into following error,can anyone suggest how to overcome below error? Installed pyodbc using the following commands sudo

Solution 1:

You should start by setting up and configuring FreeTDS. Here is a sample configurations from my files, but I'm sure other variants will work also. One difference is that I'm using Django, but the result below still worked eventually, but it works much better with SQL authentication than with Windows Authentication.

From /etc/freetds/freetds.conf (use the IP of the server if DNS is not active for the server name).

# A typical Microsoft server
[MyServer]
        host=10.0.0.10\pathport=1433tdsversion=7.0

From /etc/odbcinst.ini

[FreeTDS]Description = FreeTDS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.s

From /etc/odbc.ini

[MyServer]Description = "Some Description"Driver = FreeTDS
ServerName = servername\path
Server = servername
Port = 1433Database = DBNAME

Then this command connects me to the database.

tsql -S MyServer -U username@servername -P password

Post a Comment for "Pyodbc.error: ('im002', '[im002] [unixodbc][driver Manager]data Source Name Not Found, And No Default Driver Specified (0) (sqldriverconnect)')"