Python-DB2 module and DB2 Connect
Michael Ströder
michael at stroeder.com
Sat Mar 16 07:43:01 EST 2002
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?
>>
>>Seems to work. (DB2 Connect under Linux against DB2 OS/390 6.x)
>
> With DB2 UDB EE 7.1 on AIX 4.3.3.1, Python 1.5.2 and DB2.py 0.991
>
> create table X(Y decimal(5,2), Z integer)
>
> 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.
More information about the Python-list
mailing list