Subject | Error in SELECT string from BLOB (DataTruncation) |
---|---|
Author | Kenneth Foo |
Post date | 2002-08-23T06:05:10Z |
Hi
I'm having problem with a code like
this...
Object from =
"test123456789012345678901234567890";
PreparedStatement ps = con.prepareStatement("SELECT
ID FROM MESSAGES WHERE MSG_FROM=?;");
ps.setObject(1, from);
ResultSet rs = ps.executeQuery();
MSG_FROM field is type BLOB (subtype 1 -
MEMO).
When setObject is called, a java.sql.DataTruncation
exception is thrown.
I traced through the latest Type4 driver, and found
that this exception is thrown
in the function setString of FBStringField, line
274 which reads...
if
(supplied.length >
field.sqllen)
throw new DataTruncation(-1, true, false, supplied.length, field.sqllen);
throw new DataTruncation(-1, true, false, supplied.length, field.sqllen);
field.sqllen is apparently 30 (by
default?).
Since I'm searching for a string that is longer
than 30 characters, an exception is thrown.
Is this a bug or am I missing
something?
Thanks!
Regards
Kenneth