Subject Possible bug?: GDS Exception. 335544321 when doing
Author Jerker Klang

I'm having a little web statistics system that I'm trying to convert to
firebird .However, I get an exception when trying to insert my data
(which basically is a normal apache log file). I've been running
firebird on a small scale for years (and interbase before that) so I
don't think (at least hope) that I've done any bigger mistake myself.

However, the flow looks as follows.

1. Open connection
2. Disable auto commit
--- Loop
3. Read data from file
4. For a couple of fields, do
4.1 Lookup if the field value exists in an extra table, if not add it
(using a generator for the id)
5. Do an executeUpdate for that line
6. Commit

Nothing special. There's a long running transaction with one prepared
statement alive the whole time with a number of less common prepared
statements doing the lookup for data in extra tables.

However, after a series of insert (656 to be exact) I get an exception
when doing saying:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544321.
arithmetic exception, numeric overflow, or string truncation.

The exception is quite strange, since I can't find anything that would
violate a field length. The expression returning the result set is:
"SELECT referrerId FROM t_accessreferrer WHERE referrerid=?" (I've
manually copied together the data, the string is actually constructed.
You can replace referrer with some other values).

The table looks like this:
Primary key (REFERRERID)

Basically nothing special, and there isn't much hidden behind the
scenes. The text I'm searching for are a humble 41 characters long, so
well within the field limit.

However, I've noticed after a lot of debug output that the referrer
inserted the operation before this one (but with an execute of the long
running statement in between) contained a 338 character string. That
string should be well within the limit as well, but I'm started to do
some diagnostics around it.

If I truncate all strings to not exceed 256 characters, the whole
execution succeeds. If I set the limit (trancate all strings in Java) to
257 I get this error.

Can somebody please enlighten me what's happening?

The environment is as follows:
Windows XP Pro
Firebird 1.5.3 (and I've tried with 1.5.2)
JayBird 1.5.6 and 2.0.1
JDK 1.5.0_06 (running default hotspot client)
Database default character set: ISO8859_1.