That is not derby specific. In any db selects are part of transactions too. So either you enable
autocommit or you explicitly commit your transaction(s) before releasing the connection. Commit
will release the locks you acquired on the db (read locks if you haven't modified anything).
Cheers,
Florin
Von: Malte.Kempff@de.equens.com [mailto:Malte.Kempff@de.equens.com]
Gesendet: Dienstag, 22. November 2011 12:09
An: derby-user@db.apache.org
Betreff: Does derby ned allways a rollback or commt?
Hi,
I have an application using embedded derby (10.8.1.2). In the program I use a little routine
that ends with rollback, commit or nothing at all, by using a parameter.
In a certain mode I just do a select, so As far I concern I don't need to do neither rollback
nor commit, since it is just a select.
But I get then always an Exception:
Eine Verbindung kann nicht beendet werden, solange noch eine Transaktion aktiv ist.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.checkForTransactionInProgress(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.close(Unknown Source)
That obviously is the code 25001
Even though I initialize all my prepared statements that also are inserts and updates, in
this mode only a select statement is used.
How come I get such a Exception. It seems that I have to commit or rollback always I quit
a derby program even though no change has occurred on particular database
Or is there something I should care about?
Equens SE
Malte Kempff
Core Applications/ Change Bulk Payments
Tel: +49(0)69/58 99 93 - 60417
Fax: +49(0)69/58 99 93 - 60290
mail to:Malte.Kempff@de.equens.com
Equens SE
Mainzer Landstraße 201
60326 Frankfurt
Germany
Tel: +49(0)69-589993-09
Fax: +49(0)69-589993-60300
Amtsgericht Frankfurt HRB 84 429
http://www.equens.com<http://www.equens.com/>
info@de.equens.com<mailto:info@de.equens.com>
Vorstand: Michael Steinbach (Vorstandsvorsitzender)
Alessandro Baroni
Dr. Götz Möller
Jan Sonneveld
Aufsichtsratsvorsitzender: Erik Dralans
Sitz: 3526 LB Utrecht, Niederlande, Eendrachtlaan 315, Handelskammer 3022.0519
|