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.kem...@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/ i...@de.equens.com mailto:i...@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
AW: Does derby ned allways a rollback or commt?
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.kem...@de.equens.com [mailto:malte.kem...@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.kem...@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.comhttp://www.equens.com/ i...@de.equens.commailto:i...@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
AW: Does derby ned allways a rollback or commt?
So what would be the best practice using a rollback or a commit when just reading a database? Malte Von: florin.herin...@sungard.com [mailto:florin.herin...@sungard.com] Gesendet: Dienstag, 22. November 2011 12:14 An: derby-user@db.apache.org Betreff: AW: Does derby ned allways a rollback or commt? 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.kem...@de.equens.com [mailto:malte.kem...@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.kem...@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/ i...@de.equens.com mailto:i...@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
Re: AW: Does derby ned allways a rollback or commt?
I would extend your question: is there any difference in commit or rollback after single select statement? Dne 22.11.2011 12:45 malte.kem...@de.equens.com napsal(a): ** So what would be the best practice using a rollback or a commit when just reading a database? ** ** Malte -- *Von:* florin.herin...@sungard.com [mailto:florin.herin...@sungard.com] *Gesendet:* Dienstag, 22. November 2011 12:14 *An:* derby-user@db.apache.org *Betreff:* AW: Does derby ned allways a rollback or commt? ** ** 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.kem...@de.equens.com [mailto:malte.kem...@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.kem...@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 i...@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 ** **
AW: Does derby ned allways a rollback or commt?
I'd say commit. Commit is the regular operation when all works as expected. Florin Von: malte.kem...@de.equens.com [mailto:malte.kem...@de.equens.com] Gesendet: Dienstag, 22. November 2011 12:45 An: derby-user@db.apache.org Betreff: AW: Does derby ned allways a rollback or commt? So what would be the best practice using a rollback or a commit when just reading a database? Malte Von: florin.herin...@sungard.commailto:florin.herin...@sungard.com [mailto:florin.herin...@sungard.com] Gesendet: Dienstag, 22. November 2011 12:14 An: derby-user@db.apache.orgmailto:derby-user@db.apache.org Betreff: AW: Does derby ned allways a rollback or commt? 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.kem...@de.equens.commailto:malte.kem...@de.equens.com [mailto:malte.kem...@de.equens.com] Gesendet: Dienstag, 22. November 2011 12:09 An: derby-user@db.apache.orgmailto: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.kem...@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.comhttp://www.equens.com/ i...@de.equens.commailto:i...@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
Re: AW: Does derby ned allways a rollback or commt?
On 11/22/2011 04:01 AM, Peter Ondruška wrote: I would extend your question: is there any difference in commit or rollback after single select statement? Nothing much that I ever found. I always use commit to complete my selects, because it feels cleaner, at the application level, to use rollback only when I am intending to undo an operation. thanks, bryan