jdbc - DB2 SQLCODE:-302 SQLSTATE:22001 when inserting rows with replacing new line characters -
i'm faced problem error occurred trying insert rows replacing new line characters.
the environment:
os: aix 7
dbms: db2
version of jdbc driver: db2jcc4-10.5.4
encoding: utf-8 (dbms , application)
the problem:
i have table, "tba" , has column, "content", varchar(600).
and when try insert row table simple insert query, throws sqlexception, sqlcode:-302 sqlstate:22001... , though length of content value not reach limit, 600 bytes. tried several times different values , got know limit bytes allowed insert 254.
the insert query follows:
insert tba (content) value (replace(replace(?, '\\n', chr(10)), '\\t', chr(09)))
the replace function used value inserted required because clients allowed insert line feeds , tap characters out of content value try insert, , content shown on alert messages on browser screens, using javascript.
and action of client layer submitting post request textbox element follows:
<form action="..." method="post" name=".."> <input type="text" name="content"/> </form>
the following query log written executing insert query content value has length on 300 bytes. (the value omitted.) has no problem. tried copy-paste , execute on dbms tools such toad , sql gate works fine, there's no sql errors.
insert tba (content) value (replace(replace('01234567890...', '\\n', chr(10)), '\\t', chr(09)))
and tried remove replace function in query , execute in client(browser)-server way, works fine @ all.
what missing?? replace function stretch length of value? why happens when executing in client(browser)-server way?
please let me know.
Comments
Post a Comment