Subject arithmetic exception, numeric overflow, or string truncation
Author nagypapi
WinXP sp2
Fb 1.5.2 embedded
Jaybird 2.0 RC1

table ordered:
ORDER_VALUE bigint
PB_ID bigint
STATE int
ORDER_DATE timestamp
SZTORNO varchar(3)
BENTI smallint


I get the following error:
"
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544321.
arithmetic exception, numeric overflow, or string truncation
at
org.firebirdsql.jdbc.FBStatementFetcher.fetch(FBStatementFetcher.java:206)
at
org.firebirdsql.jdbc.FBStatementFetcher.next(FBStatementFetcher.java:119)
at org.firebirdsql.jdbc.FBResultSet.next(FBResultSet.java:250)
at MyPackage.myFunc(MyProgram.java:1506)
"

The error occurs at a "while(rs.next())"
in the following function (trimmed the query a bit):

synchronized long myFunc(String futar, String from, String to) throws
Exception{
long summa=0;
String query="select sum(ORDER_VALUE) from ORDERED,PIZZABOY";
query+=" where ORDERED.STATE = " + Order.UNDER_SHIPMENT;
query += " and ORDERED.ORDER_DATE >= '" + from + "'" + " and
ORDERED.ORDER_DATE < '" + to + "'";
query += " and ORDERED.SZTORNO='no' ";
query += " and ORDERED.benti=0 ";
query += " and ORDERED.PB_ID = PIZZABOY.PB_ID and
PIZZABOY.PB_NAME = '" + futar + "'";

Statement st=conn.createStatement();
ResultSet rs=null;
rs=st.executeQuery(query);

ERROR IS HERE: while(rs.next()) {
summa = rs.getLong(1);
}
rs.close();
st.close();
return(summa);
}


I could not reproduce this error even when I did the same thing the
users did.
They were able to produce the error a few times successively, so they
restarted the program, and the error didn't come back.
This part of the program has been in use for about 2 months and this
has never happened before.

What may cause this error?
How come I get a arithmetic exception, numeric overflow, or string
truncation
from a while(rs.next()) ?
I am sure that select sum(order_value) doesn't give back a number
larger than long

Thanks,
John

ps: If you want, you can freely criticise my coding, I actually
appreciate it :)

btw Roman, does the RC2 jaybird support backing up without
username/pass in case of embedded?