Subject | Re: [Firebird-Java] arithmetic exception, numeric overflow, or string truncation |
---|---|
Author | Roman Rokytskyy |
Post date | 2005-10-01T21:42:32Z |
> What may cause this error?I see following possibilities:
a) a sum(...) is bigger than 2^63-1, that could include only values visible
in that transaction, so they could reproduce it and you couldn't. That would
be numeric overflow.
b) "futar" variable was too long. That would be string truncation.
> How come I get a arithmetic exception, numeric overflow, or stringNo idea. I would expect it to happen during execute, but it also can be that
> truncation from a while(rs.next()) ?
server started to evaluate query on the first fetch (that would be the a)
case)... But no clue, one has to check the server behavior for this query.
> I am sure that select sum(order_value) doesn't give back a numberThen I have no other ideas... Maybe Firebird-Support would be more
> larger than long
helpful...
> ps: If you want, you can freely criticise my coding, I actuallya) I use prepared statements instead of concatenation. First, "futar" can
> appreciate it :)
contain single-quote for example, that will cause error during statement
preparation. Second, connection pool might also cache prepared statements,
so that would increase the performance.
b) I use the try/finally blocks for connections and statements:
Connection conn = ds.getConnection();
try {
Statement stmt = conn.createStatement();
try {
....
} finally {
stmt.close();
}
} finally {
conn.close();
}
That guarantees that resources are always freed, even when exception happens
(which in does not happen in your code).
> btw Roman, does the RC2 jaybird support backing up withoutI did not do anything there, since there were no bug report and I did not
> username/pass in case of embedded?
(and do not) remember that this was raised here. But I just checked the
code - you're right, it causes NPE if no user name and password is
specified. Will be fixed in final release.
But it won't help you - server expects either SYSDBA or db owner account
even in embedded mode. So, you have to fill a feature request for Firebird
Embedded instead.
Thanks!
Roman