On 03-08-2026 06:58, 'Hugo Larson' via firebird-java wrote:
> Understood.
>
> I suspect there is an threading issue with Jaybird since the start.
> With my ancient library I get often one of these exceptions.
>
> "The result set is closed", "connection shutdown", "This connection is
> closed and cannot be used now", "no transaction for request",
> "Connection closed or no connection available"
Possibly, though most of the operations of Jaybird or protected by a
lock. However, even in that case, if you use a single connection from
multiple threads concurrently, you can run into problems. If you have a
reproducible case (preferably an artificial one), I'll be happy to
investigate.
However, some of those errors have some common causes:
"The result set is closed"
* Attempt to execute another statement on a `Statement` while still
trying to use the result set from the previous execution on that `Statement`
* Attempt to execute another statement in auto-commit mode, while trying
to use the result set produced by another `Statement` of that same
`Connection`
* If multiple threads use the same connection concurrently, it might
even be easier to cause this unknowingly
Especially for this error, I would take a closer look at that Borland
library, because these are especially the things older JDBC
specifications were less clear about, and where actual behaviour can
vary wildly between drivers.
"connection shutdown"
* Reported by the server if the database was shutdown with gfix (or
FBMaintenanceManager or similar); the server might report this for other
cases as well
"This connection is closed and cannot be used now"
* Reported if the FBConnection (JDBC connection) is marked as closed.
** A connection can also get implicitly closed if Jaybird considers some
errors to be fatal (e.g. indicate a broken connection). This would
usually follow after an earlier exception
(Jaybird 6 and higher will report "The connection is closed")
"no transaction for request"
* If this is reported by the Jaybird, it means the JDBC connection is no
longer associated with a physical connection. This is pretty much the
same error as previous, but would only happens if either a validity
check is missing, or if the connection was broken during an operation.
** To be clear, this is pretty much the "wrong" error message, but as
it's been used for a very long time in Jaybird code, I haven't touched
it (yet).
** The message is used because internally Jaybird can bind and unbind
JDBC connections (or, its FBManagedConnection) on different physical
connections; however that case shouldn't occur when used as a plain JDBC
connection.
* It might also be reported by the server, and could then indicate a
Jaybird having done something wrong.
"Connection closed or no connection available"
* Reported if the socket was never opened, or is now closed. It should
only be possible for this to get reported if a connection gets broken in
the middle of an operation.
(Jaybird 6 and higher will report "The connection is closed")
These are the "normal" cases, and not if they happen during
finalization. During finalization, basically all bets are off. This is
also why in Jaybird 6 I removed some outright, without replacing them
with a cleaner. I'll see if those same cases should also be removed in
Jaybird 5.
For the last three cases, you may want to wait for Jaybird 5.0.13 and
try the Boolean system property
org.firebirdsql.jdbc.connection.forceCloseOnFatal introduced with
https://github.com/FirebirdSQL/jaybird/issues/893. When set to false,
Jaybird will not invalidate the connection if an exception occurs that
it deems fatal. That's no guarantee for a fix (it might just cause a
lower level error because the connection was indeed broken but now not
marked as closed), but sometimes the classification of errors as fatal
is wrong.
Mark
--
Mark Rotteveel