|Subject||Re: [Firebird-Java] Fwd: Re: Problem with multi-threaded update/query causing JDBC driver errors|
> Basically, you can´t share a single connection between many threads. Make sure each thread get the connection, use it, close it and return to the pool (if there is a pool).This is also a limitation in JavaEE, so it is always safe to use
> Even now that firebird client is threadsafe, you should use the procedure described above, to avoid waiting for client synchronization.Jaybird normally does not use Firebird client, and I did my best to put
all needed synchronizations in the driver, but there must be some
possibility where it does not work.
> Remember also that you can´t open two resultsets at the same time using the same JDBC connection. It causes the errors you are describing. I think it´s related to JDBC specification, not to Jaybird implementation.You can have multiple open result sets for different statements in
non-autocommit mode. So you can loop though one result set and execute
statements within the loop.
In auto-commit mode specification requires us to close previous
statement before we execute next one. In this case previous example with
loop won't work.
> If you want to open many resultsets at the same time using just one connection, take a look at CachedRowSet interface and default implementation (rowset.jar, you can download it somewhere).If you specify that you want scrollable result set, Jaybird will cache
all rows in memory. But that is implementation specifics.