Subject Re: FireBird lock problem
Author Roman Rokytskyy
> Actually the synchronized block is in the driver's code of
> executeUpdate method. This doesn't return while some other query
> from other thread want to do one more executeUpdate

Well... if you think that communication goes via sockets, you would
understand that some kind of synchronization is needed on per socket
layer (otherwise server would receive garbage). This means that before
one query is fully executed, you cannot use the same connection for
anything else (otherwise server will not understand what's happening
in the socket pipe).

Also, JayBird 1.0.x does not contain synchronization. This is a bug
preventing us from using one connection from multiple threads, but
specification requires us to allow this. I fixed this in 1.5 (HEAD)
version of the code. You can see, that depending on the execution mode
(auto-commit or not), different sync objects are used.

In autocommit mode synchronization happens on connection object, which
is ok accroding to the specification, since there can be only one
active object at a time. Due to implementation of result set handling
in auto-commit mode, you will not be able to execute new query before
the complete result set is fetched from the server. This behavior is
not going to be changed in JayBird 1.5.

In non-autocommit mode synchronization happens on statement object,
which is also correct, since we have to guarantee that no garbage goes
into the socket.

Hope this helps.

Best regards,
Roman Rokytskyy