Issue 162: connect() trying to set SQL_ATTR_AUTOCOMMIT although not requested
Status:  NoFix
Owner: ----
Closed:  Dec 2011
Reported by Wurm...@gmail.com, Mar 10, 2011
I encountered this bug while trying to work with the ODBC Lotus Notes Driver.

Even though according to [1] autocommit defaults to False and even though I tried manually forcing it not to request autocommitting by explicitly setting autocommmit=False it appears that pyodbc still tries to set it.

The error is:
Error: ('S1C00', '[S1C00] [Lotus][ODBC Lotus Notes]Driver not capable (23370) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))')

First I thought it might be a bug in the ODBC Lotus Notes driver, but I tested the driver with PHP's ODBC functions and everything works fine there.

What version of the product are you using? On what operating system?
pyodbc 2.1.8 with Python 2.7.1 on Windows XP SP3

[1] https://code.google.com/p/pyodbc/wiki/Module#connect
Mar 15, 2011
#1 lukedell...@gmail.com
ODBC defaults to autocommit *on*, so if you want to disable pyodbc from making this call to the driver then explicitly set autocommit=True
Mar 16, 2011
#2 Wurm...@gmail.com
Thanks, that did it.

I find it relatively unintuitive to have to specify autocommit=True to actually turn off autocommitting. Could the documentation be updated?
Mar 21, 2011
#3 lukedell...@gmail.com
Oh no autocommit=True turns *on* autocommitting as you would hope.

The key to understanding your initial problem is that ODBC defaults to autocommit enabled, whereas pyodbc must default to autocommit disabled (by decree of the Python Database API, PEP 249).  This means that by default pyodbc must explicitly call the ODBC API to disable autocommit.  It is this call which is failing for your Lotus Notes driver.  Specifying autocommit=True means that pyodbc can skip making this call.
Mar 21, 2011
#4 Wurm...@gmail.com
Well, I guess this problem is then very specific to my case. I suppose there are not many SQL drivers out there not supporting SQL_ATTR_AUTOCOMMIT.

Probably violates the ODBC standard, but hey, the driver is mapping a non-SQL database format (Notes Storage Format, NSF) to SQL.
Dec 26, 2011
Project Member #5 mkleehammer
Luke, thanks again!
Status: NoFix