안녕하세요.
DB2를 처음 사용하는데
C#에서 DB2를 연결하여 자료를 검색시
다음의 오류가 발생합니다.
truncated SQLSTATE=01004 CLI0002W Data TRUNCATED.
SQLSTATE=01004
SELECT RTRIM(LTRIM(CARNO)) FROM T03YVANH
시 오류가 발생합니다.
해당 CARNO는 한글 타입입니다.
문제를 해결할수 있는 방법이 무엇인지요..
DB2 CONNECT는 7.2입니다
CLI0002W와 관련된 것들을 보니까 대게 아래 2가지를 하라고 하네요. 1. db2의 Fix를 올리세요. 가능하시면 최종 Fix까지 적용하세요. 2. db2cli.ini에 DISABLEUNICODE=1 를 적용하세요. CLI0002W DATA TRUNCATED WHEN EXECUTING A CALL TO A STORED PROCEDURE
Fixes are available DB2 Universal Database Version 7 FixPak 11 DB2 Universal Database Version 7 FixPak 12 DB2 Universal Database Version 7 FixPak 13
APAR status Closed as program error.
Error description Customer seeing CLI0002W Data Truncated error message when execu ting a call to a stored procedure using XA. Local fix Use DISABLEUNICODE=1 in the db2cli.ini file.
Use DISABLEUNICODE=1 in the db2cli.ini file.
을 sample을 구할수 있나요..
Window는 IBM 폴더 아래에 있고 unix는 sqllib/cfg아래에 있습니다.
1. 수동으로 db2cli.ini 변경
- 해당 값을 common 이라는 section안에 넣어준다. common secion이 없는 경우에는 만들어주면 된다.
; Comment lines start with a semi-colon.
[tstcli1x]
uid=userid
pwd=password
autocommit=0
TableType="'TABLE','VIEW','SYSTEM TABLE'"
[tstcli2x]
; Assuming dbalias2 is a database in DB2 for MVS.
SchemaList="'OWNER1','OWNER2',CURRENT SQLID"
[MyVeryLongDBALIASName]
dbalias=dbalias3
SysSchema=MYSCHEMA
[common]
DISABLEUNICODE=1
2. update cli cfg를 이용하여 변경
- section명으로 common을 주면 common section이 없는 경우 생성이 된다.
db2 update cli cfg for section common using DISABLEUNICODE 1
확인 방법
db2 get cli cfg
지정 값을 삭제하려는 경우 직접 파일을 수정하거나 null값으로 cli cfg값을 update한다.
db2 update cli cfg for section common using DISABLEUNICODE NULL