com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC:

com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC:

Post by xix » Sun, 22 Jun 2003 07:10:58



hi, we are using db2 v8.1 fixpack 2 on NT. i have create a database
with code set UTF-8, when i try to copy the table from AS400 to DB2, i
got the error
com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -302,
SQLSTATE: 22001, SQLERRMC:

the table on AS400 contains Japanese data, i try to create the table
to store Japanese data on DB2.

But if i change the length of each field to 4 times of the original
length, i can pass and generate the table with data.

Since now on DB2 the length stored in sysibm.syscolomuns is 4 times of
the actual length, so i have to divide this length by 4 to get the
actual length of each field. But the problem is some of the fields is
substring of another field, e.g. apkey on AS400 is 8 length now, after
copy the table to DB2, it becomes 32 bytes long. i have key2
substr(apkey,1,6), then key2's actual length stored in
sysibm.syscolomuns, so looks like some of the fields are 4 times of
original field, some are the actual length. that causes my program
problem , because i assumes all the fiels definition must divide by 4
to get the right length .

i don't understand why i need to 4 times length, because as i see all
the value occupy one byte for up to 8 if the length is 8 bytes, if i
times 4 , that would be 32 length, so the rest 24 byte are space.
please help. thanks