[DB-SIG] Simple query failure to MS SQL Server Database using mx.ODBC.Wind ows

Geter, Frank fgeter@itc.nrcs.usda.gov
Tue, 1 Apr 2003 14:23:29 -0700


I am trying to use mx.ODBC.Windows connect to a remote MSSQL database
through my local ODBC data object called OipNcapsData.  I am running Windows
2000 and I downloaded and installed the mxODBC files yesterday.  I can
connect to the database using the same object and successfully run queries
against it using other tools.  I have checked with the database people and I
have permission on the view and tables behind it that I am trying to access.
The following is the python code that shows the error.  After that code is
more code showing another python odbc connection using the same ODBC object
that works.

Code that does no work
----------------------
Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mx.ODBC.Windows
>>> db=mx.ODBC.Windows.DriverConnect('DSN=OipNcapsData')
>>> c=db.cursor()
>>> c.execute('select * from site')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
mxODBC.Warning: ('01000', 7312, '[Microsoft][ODBC SQL Server Driver][SQL
Server][OLE/DB provider returned message: New transaction cannot enlist in
the specifie
d transaction coordinator. ]', 4606)


Code that works
---------------
>>> import odbc, dbi
>>> db=odbc.odbc('OipNcapsData//')
>>> c=db.cursor()
>>> c.execute('select site_id from site where site_id < 25')
0
>>> c.fetchall()
[(1,), (2,), (3,), (4,), (5,), (6,), (7,), (9,), (10,), (11,), (12,), (13,),
(14,), (15,), (16,), (17,), (18,), (19,), (20,), (21,), (22,), (23,)]
>>>


Frank Geter
2150 Centre Avenue, Bldg. A
Fort Collins, CO 80526-1891
Ph# (970) 295-5536
Fax# (970) 295-5414