Subject Re: Beta4?
Author Roman Rokytskyy
> > I have fixed problems reported here some time ago:
> > - parser error when calling procedure without params or with
> > " ()" at the end;
> > - error when inserting some varchar data exceeding available
> > size, which caused connection to enter the "unusable" state.
> Is this the one resulting in operation cancelled?

It still results in op_cancel, this is a server issue. And it is
related to NPE in

> > Last fix should also fix problem with JBoss reported here
> > (NullPointerException deep in the code). If there's interest
> > to listen to the story, I will write it separately.
> This is the nullpointer in, right? This is great
> news... :-)
> If it is, a story would be nice :-)

Story is simple. Sending more char data than expected makes server to
issue op_cancel. After that it invalidates complete connection. Any
subsequent operation causes IOException, then GDSException. This is
ok, one can live with it. However, JCA framework tries to be
intelligent - when it starts transaction and failure happens, it
invalidates physical connection (e.g. db.out = null), creates new
connection and starts new transaction. So far so good - old
connection does not exist. However there is one "feature" (correct
from concept, but under current circumstances it does not work).
Statement handle is valid only for some specific connection. Also
class representing statement handle has reference on db handle in
which is was allocated. And when connection is invalidated,
statements are not invalidated.

After this the problem is clear: when due to an error connection was
invalidated, but we still use old statement (you can see such use in
test case for op_cancel exception posted here), GDS_Impl fetches
connection from the the statement handle (API reasons, for example
isc_dsql_sql_info() takes only statement handle, no transaction
handle). Since connection was invalidated, it throws NPE.

Current fix checks if statement has invalid connection, and throws
SQLException in this case. This means that any operation with a
statement will fail. However connection is still alive and can be
used further.