Closed GoogleCodeExporter closed 9 years ago
What do you mean by connection codepage here, and what the error message you
gets during insert/update of data
Original comment by rahul.pr...@in.ibm.com
on 3 May 2013 at 6:54
when the python program starts I print the
ibm_db.client_info().CONN_CODEPAGE (1208) and APPL_CODEPAGE attributes
(1253). I do not get any error message during insert/update, but the data
inserted/updated are invalid. when i run a select query for the relevant
columns to see what has been placed in there, I see something like this
'Νικος Ζ Κατσαρο�' . I want to point out that I only have this
problem with ibm_db/python. Everything else works fine (that is : python
with pyodbc , java , c/c++, microfocus cobol)
Original comment by zisisk...@gmail.com
on 3 May 2013 at 7:31
could you please share the sample test script to reproduce this issue.
Original comment by rahul.pr...@in.ibm.com
on 3 May 2013 at 9:29
I have tried with u'Ομάδ' greek word but it get inserted and retrieved
correctly.
Original comment by rahul.pr...@in.ibm.com
on 3 May 2013 at 9:35
The Connection codepage you are getting is not changeable through any setting,
It depends on your Database codepage and Application codepage.
Original comment by rahul.pr...@in.ibm.com
on 3 May 2013 at 9:39
# coding:iso-8859-7
from ibm_db import *
con=connect("DRIVER={IBM DB2 ODBC DRIVER};"+
"DATABASE=DB2LT;HOSTNAME=10.2.7.116;PORT=50001;PROTOCOL=TCPIP;"
"UID=DB2TEST;PWD=db2test;","","")
ci=client_info(con)
print 'APPL_CODEPAGE=',ci.APPL_CODEPAGE,'CONN_CODEPAGE=',ci.CONN_CODEPAGE
s=exec_immediate(con,"update kats.ttab1 set vdat='����� � ��������'")
n=num_rows(s)
print 'Number of rows Updated=', n
stmt = exec_immediate(con,"select vdat from kats.ttab1")
r = fetch_tuple(stmt)
while r:
print r[0]
r = fetch_tuple(stmt)
--------------------------------------------------------------------------------
-----
This is the output from the above script
APPL_CODEPAGE= 1253 CONN_CODEPAGE= 1208
Number of rows Updated= 6
Νικος Ζ Κατσαρος
Νικος Ζ Κατσαρος
Νικος Ζ Κατσαρος
Νικος Ζ Κατσαρος
Νικος Ζ Κατσαρος
Νικος Ζ Κατσαρος
Original comment by zisisk...@gmail.com
on 3 May 2013 at 9:41
This problem is due to Literal Replacement Feature of CLI which is ON in
default. Please tern it OFF by passing QUOTED_LITERAL_REPLACEMENT_OFF
environment variable in connect() function
eg: ibm_db.connect(database_name, user_name, password, {},
ibm_db.QUOTED_LITERAL_REPLACEMENT_OFF)
From the next release we are thinking of to disable the Literal Replacement
Feature in default.
This problem can also be get resolved by passing the data through parameter
marker.
eg s = ibm_db.prepare(con, "update kats.ttab1 set vdat= ?")
ibm_db.execute(s, (u'����� � ��������', ))
Original comment by rahul.pr...@in.ibm.com
on 3 May 2013 at 10:03
did you try u'����' inside a python program with imb_db ? (because as I
told you everything else works fine) in any case I have also tried the
following: s=exec_immediate(con,u"update kats.ttab1 set vdat='����� �
��������'")
s=exec_immediate(con,"update kats.ttab1 set vdat='"+u'����� �
��������'+"'") and I had the same results.
2013/5/3 Zisis Katsaros <zisiskats@gmail.com>
Original comment by zisisk...@gmail.com
on 3 May 2013 at 10:04
OK !!!! problem solved ... many thanks (and have a nice weekend)
2013/5/3 Zisis Katsaros <zisiskats@gmail.com>
Original comment by zisisk...@gmail.com
on 3 May 2013 at 10:09
Original comment by rahul.pr...@in.ibm.com
on 3 May 2013 at 10:12
Original issue reported on code.google.com by
zisisk...@gmail.com
on 2 May 2013 at 3:40