[egenix-users] Using mxodbc with SQL Server 2012
John Anderson
sontek at gmail.com
Wed Sep 2 12:36:51 CEST 2015
Hey, We currently use pymssql and it was recommended that we checkout
mxODBC again (its been a few years) and even though most of our projects
require python 3 we have a few legacy python applications that are still on
python 2.7 so I thought I would give it a try.
I'm currently getting this error:
mx.ODBC.Error.OperationalError: ('08003', 0, '[unixODBC][Driver
Manager]Connnection does not exist', 13710)
with this code:
import mx.ODBC.unixODBC as mx
db = mx.DriverConnect('DSN=mt1;UID=<secret>;PWD=<secret>')
c = db.cursor()
c.tables()
res = c.fetchall()
and I'm wondering might cause that because I can use isql/tsql and it works:
tsql -S mt1 -U <secret> -P <secret>
isql mt1 <secret> <secret>
osql is the only one that doesn't work:
osql -S mt1 -U <secret> -P <secret>
checking shared odbc libraries linked to isql for default directories...
strings: '': No such file
trying /tmp/sql ... no
trying /tmp/sql ... no
trying /etc ... OK
checking odbc.ini files
reading /home/sontek/.odbc.ini
[mt1] not found in /home/sontek/.odbc.ini
reading /etc/odbc.ini
[mt1] found in /etc/odbc.ini
found this section:
[mt1]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = Yes
TraceFile = /tmp/sql.log
ServerName = mt1
Database = SM_AccountsNew
looking for driver for DSN [mt1] in /etc/odbc.ini
found driver line: " Driver = FreeTDS"
driver "FreeTDS" found for [mt1] in odbc.ini
found driver named "FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /etc/odbcinst.ini
found driver line: " Driver =
/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so"
found driver /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so for [FreeTDS]
in odbcinst.ini
/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so is not an executable file
osql: error: no driver found for mt1
Anyone know what I might be missing?
Here is my FreeTDS:
[mt1]
host = mt1-db01.corp.surveymonkey.com
port = 1433
tds version = 7.3
client charset = UTF-8
odbc.ini:
[mt1]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = Yes
TraceFile = /tmp/sql.log
ServerName = mt1
Database = SM_AccountsNew
odbcinst.ini:
[FreeTDS]
Description = TDS
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Startup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
UsageCount = 1
Threading = 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /mailman-archives/egenix-users/attachments/20150902/8ec7049c/attachment.htm
More information about the egenix-users
mailing list