Subject Re: [Firebird-Java] "invalid request handle" in FB 2.0 with Java
Author Roman Rokytskyy
> - sometimes a query would not execute because the resultset is already
> closed (but it works after going back to the page straight away)

Most likely you use auto-commit mode and database connection is shared
between multiple threads (e.g. one connection per application). The issue is
that JDBC 3.0 specification requires us to close the result set when another
statement is executed on the same connection. The fact that the bug is
intermittent is very likely caused by a race condition between two or more
concurrent page invocations that access the same connection.

Use connection-per-page scenario (e.g. use connection pool, obtain the
connection when request arrives and return it back when response is

> - and most of all, some prepared statements or resultset closing return
> the following error:
> org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544327. invalid
> request handle

Race condition on the Statement object between two or more concurrent page
invocations. One thread has closed the statement and another one tries to do
the same thing (or, do anything else with the statement).