Python-DB2 module and DB2 Connect

Steve Williams stevewilliams at wwc.com
Mon Mar 18 19:38:47 EST 2002


Michael Ströder wrote:
> Steve Williams wrote:
> 
>> =?ISO-8859-15?Q?Michael_Str=F6der?= wrote:
>>
>>> Michael Ströder wrote:
>>>
>>>> Anyone here which had success with using DB2-Python-0.991 (see
>>>> ftp://people.linuxkorea.co.kr/pub/DB2/) build against DB2 Connect?
>>>
[snip]

>>     cursor.execute("insert into X(Y,Z) values ?, ?",('123.45','10'))
>>
>> fails with SQL0408N, SQLSTATE=42821, type mismatch.
>>
>> However,
>>
>>     cursor.execute("insert into X(Y,X) values cast(? as
>> decimal(5,2)),cast(? as integer)",('123.45','10'))
>>
>> succeeds.
>>
>> The failing insert succeeds on Windows 2000 with mxODBC and ODBC
>> connected to the same database.  The Windows CLI/ODBC settings don't
>> seem to show any particular magic.
> 
> 
> Does the SQL statement also work in the commad-line tool db2?
> 
> Well, I finally succeded after setting PATCH1=0 and PATCH2=0 in 
> db2cli.ini and using SQL statements valid for DB2 OS/390.
> 
> Though I have to admit that I'm a RDBMS newbie just starting to get 
> involved with DB2 for a rather simple project.
> 
> Ciao, Michael.
> 
Well, clearly, the error message is correct.  The execute command
should fail, and the INSERT does indeed fail in the command line tool.

My point here is to be careful moving from ODBC to the API,
because ODBC may do some extra [helpful] things.

The DB2 API works for me.

Steve






More information about the Python-list mailing list