Help, please

385 views
Skip to first unread message

Christian Espinoza

unread,
Sep 12, 2012, 3:34:11 PM9/12/12
to pyo...@googlegroups.com
Hello, I'm newbie with pyodbc, I'm trying to install it on a Centos 6.2 and I need connect a mssql, but 
I don't know what I need to do it, I have installed pyodbc, but I can't connect successful to my DB

 >>> cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=10.0.0.50;DATABASE=testdb;UID=test;PWD=test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

My odbcinst.ini doesnt't have a definition for mssql:

# Example driver definitions

# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description     = ODBC for PostgreSQL
Driver          = /usr/lib/psqlodbc.so
Setup           = /usr/lib/libodbcpsqlS.so
Driver64        = /usr/lib64/psqlodbc.so
Setup64         = /usr/lib64/libodbcpsqlS.so
FileUsage       = 1


# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib/libmyodbc5.so
Setup           = /usr/lib/libodbcmyS.so
Driver64        = /usr/lib64/libmyodbc5.so
Setup64         = /usr/lib64/libodbcmyS.so
FileUsage       = 1


I need to install something more? some mssql driver???

Well, thanks in advance.
Christian.

Michael Kleehammer

unread,
Sep 26, 2012, 6:08:55 PM9/26/12
to pyo...@googlegroups.com
If you are running a 64-bit Python, you can probably use the Microsoft ODBC driver for Linux: 


(You should search for later versions, but this is the latest I know of: v1.0)

Otherwise, you'll need FreeTDS, which is an open source ODBC driver for SQL Server.  There will be a RPM available, but you really want version 0.91+, so double check the version.  If the RPM supplied by CentOS 6 is too old (< 0.91), I would recommend downloading the source and installing it manually.  It will save you a lot of trouble.

Reply all
Reply to author
Forward
0 new messages