db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valentin Cozma <vco...@elfyard.com>
Subject Re: Does using DerbyDB require synchronization?
Date Wed, 10 Sep 2008 07:08:44 GMT
derbyfan195 wrote:
> Just started using Derby in my Java code and realized some weird
> synchronization issues. I have multiple threads accessing the same Derby
> Database (embedded one) through a single connection. They issue read-only
> queries, i.e., select, each with its own statement, and does some operations
> on the returned ResultSet using ResultSet.next() operation. However, I
> noticed sometimes, one of these next() calls would fail and gave me an error
> of next() is not permitted, make sure that AUTO_COMMIT is turned OFF. I
> don't know what this error means or why I need to turn AUTO_COMMIT off. Do I
> need any synchronization among the statement objects obtained from the same
> connection object? Any help would be appreciated.
>   

I had some similar situation .

In the beginning I used derby in embedded mode , prepared statements 
with single connection / single thread.

Then I switched to single connection / multiple threads.

For me the temporary solution was to synchronize all java methods that 
had database access.

Now I'm using connection pool with prepared statements.


> -
> Hai
>   


Mime
View raw message