adodbapi integer parameters and MS Access

Joe JoeSalmeri at hotmail.com
Sun Mar 13 18:04:56 EDT 2011


Here is my environment:

Windows 7 x64 SP1
Python 3.2
adodbapi 2.4.2
MS Access

Although the above environment is what I am currently using I have
encountered this same problem with Python 3.1.1.   It is not a problem
with Python 2.x.

The problem is as follows:

If you are using a select statement like:

select col_1, col_2 from table where (col_1 = ?)

and you are using the qmark parameter style

and you pass in an integer (for example:  (1, )) for the parameters,
you get the following error:

(-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB Provider
for ODBC Dri
vers', '[Microsoft][ODBC Microsoft Access Driver]Optional feature not
implemente
d ', None, 0, -2147217887), None)
Command:

select col_1, col_2 from table where (col_1 = ?)

Parameters:
[Name: p0, Dir.: Input, Type: adBigInt, Size: 0, Value: "1",
Precision: 0, Numer
icScale: 0]


If you run the same code using pyodbc or odbc in Python 3.2 (or 3.1.1)
it works fine so I know it is not a problem with the ODBC driver.

If you run the same code in Python 2.6.2 and adodbapi it also runs
fine.

Further investigation using different tables and columns seems to
conclude that:

adodbapi + Python 3.x + qmark parameters + parameters that are
integers produces this error.

col_1 in the database is defined as a number (long integer with 0
decimal positions).

If you convert the parameter to a string (str(1), ) then adodbapi
works in Python 3.2.

Is this a known bug?



More information about the Python-list mailing list