[egenix-users] Using mxodbc with SQL Server 2012

M.-A. Lemburg mal at egenix.com
Wed Sep 2 23:05:38 CEST 2015


On 02.09.2015 20:36, John Anderson wrote:
> 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)

This is a typical error message you get when the connection is found
by the ODBC manager, i.e. it is configured in the odbc.ini file,
but it cannot load it.

This can be a permission problem or a linker problem. You can
try this to check:

ldd /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so

Also see our documentation for FreeTDS:

http://www.egenix.com/products/python/mxODBC/doc/#_Toc427692966

A note on FreeTDS:

You should really use the MS SQL Server Native Client for
Linux, if you can. It is much more feature complete compared
to FreeTDS and also much easier to configure:

https://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx

These are the instructions from our documentation:

http://www.egenix.com/products/python/mxODBC/doc/#_Toc427692959

> 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
> 
> 
> 
> 
> _______________________________________________________________________
> eGenix.com User Mailing List                     http://www.egenix.com/
> https://www.egenix.com/mailman/listinfo/egenix-users
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 02 2015)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> mxODBC Plone/Zope Database Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2015-08-27: Released eGenix mx Base 3.2.9 ...     http://egenix.com/go83

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the egenix-users mailing list