You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Egidijus Vaisnora <eg...@nomagic.com> on 2011/02/11 11:02:00 UTC

Closing connection result with exception

Hello All,

	I am using Embedded Derby and whenever I attempt to close connection I got "Cannot close a connection while a transaction is 
still active." error.
	I am using Derby 10.5.3. I found that in Derby 10.5.1.1 in release notes there is a note about DERBY-3319, which states that 
"Users must call commit() or rollback(), or use auto-commit, before attempting to close a connection with uncommitted 
operations." But I am executing just "select" statement, do I still need to call rollback or commit?

P;ease, advice,
-- 
Egidijus

Re: Closing connection result with exception

Posted by Bernt Marius Johnsen <be...@oracle.com>.
Egidijus Vaisnora wrote:
> Hello All,
> 
>     I am using Embedded Derby and whenever I attempt to close connection 
> I got "Cannot close a connection while a transaction is still active." 
> error.
>     I am using Derby 10.5.3. I found that in Derby 10.5.1.1 in release 
> notes there is a note about DERBY-3319, which states that "Users must 
> call commit() or rollback(), or use auto-commit, before attempting to 
> close a connection with uncommitted operations." But I am executing just 
> "select" statement, do I still need to call rollback or commit?

A select statement will open an transaction which needs to be committed 
or rolled back.

> 
> P;ease, advice,


Re: Closing connection result with exception

Posted by "Sakthivel.P" <p....@gmail.com>.
refer this
http://db.apache.org/derby/docs/10.4/devguide/cdevconcepts29416.html

default auto commit is set true. if its turned off, need to commit
explicitly.

http://db.apache.org/derby/manuals/tools/tools46.html

regards
Sakthivel

On Fri, Feb 11, 2011 at 4:52 PM, Egidijus Vaisnora <
egidijus.vaisnora@nomagic.com> wrote:

>
> I have updated derby but still the same. Issue DERBY-3806 covers problem
> when ResultSet was not closed, however I am closing ResultSet, prepared
> statement and then connections. What I am not doing is commit either
> rollback calls - jsut because I am executing SELECT statement. Do I need to
> call "commit" or "rollback" in any case before "close", even if I am using
> SELECT statement and I am closing opened ResultSet and prepared statement?
>
> --
> Egidijus
>
> On 2/11/11 12:10 PM, Sakthivel.P wrote:
>
>> 10.7.1.1 <http://db.apache.org/derby/releases/release-10.7.1.1.cgi> is
>> latest version. Please download and use.
>>
>>
>> http://db.apache.org/derby/derby_downloads.html
>>
>> refer this issue for more details
>> https://issues.apache.org/jira/browse/DERBY-3806
>>
>> - Sakthivel
>>
>> On Fri, Feb 11, 2011 at 3:32 PM, Egidijus Vaisnora <
>> egidijus.vaisnora@nomagic.com <ma...@nomagic.com>>
>> wrote:
>>
>>    Hello All,
>>
>>            I am using Embedded Derby and whenever I attempt to close
>> connection I got "Cannot close a connection while a
>>    transaction is still active." error.
>>            I am using Derby 10.5.3. I found that in Derby 10.5.1.1 in
>> release notes there is a note about DERBY-3319, which
>>    states that "Users must call commit() or rollback(), or use
>> auto-commit, before attempting to close a connection with
>>    uncommitted operations." But I am executing just "select" statement, do
>> I still need to call rollback or commit?
>>
>>    P;ease, advice,
>>    --
>>    Egidijus
>>
>>
>>

Re: Closing connection result with exception

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Egidijus Vaisnora <eg...@nomagic.com> writes:

> I have updated derby but still the same. Issue DERBY-3806 covers
> problem when ResultSet was not closed, however I am closing ResultSet,
> prepared statement and then connections. What I am not doing is commit
> either rollback calls - jsut because I am executing SELECT statement.
> Do I need to call "commit" or "rollback" in any case before "close",
> even if I am using SELECT statement and I am closing opened ResultSet
> and prepared statement?

Yes, a select statement executes within a transaction and may acquire
locks that are not released until the transaction has finished, so
read-only transactions need to be committed or rolled back too.

-- 
Knut Anders

Re: Closing connection result with exception

Posted by Egidijus Vaisnora <eg...@nomagic.com>.
I have updated derby but still the same. Issue DERBY-3806 covers problem when ResultSet was not closed, however I am closing 
ResultSet, prepared statement and then connections. What I am not doing is commit either rollback calls - jsut because I am 
executing SELECT statement. Do I need to call "commit" or "rollback" in any case before "close", even if I am using SELECT 
statement and I am closing opened ResultSet and prepared statement?

-- 
Egidijus

On 2/11/11 12:10 PM, Sakthivel.P wrote:
> 10.7.1.1 <http://db.apache.org/derby/releases/release-10.7.1.1.cgi> is latest version. Please download and use.
>
> http://db.apache.org/derby/derby_downloads.html
>
> refer this issue for more details
> https://issues.apache.org/jira/browse/DERBY-3806
>
> - Sakthivel
>
> On Fri, Feb 11, 2011 at 3:32 PM, Egidijus Vaisnora <egidijus.vaisnora@nomagic.com <ma...@nomagic.com>> wrote:
>
>     Hello All,
>
>             I am using Embedded Derby and whenever I attempt to close connection I got "Cannot close a connection while a
>     transaction is still active." error.
>             I am using Derby 10.5.3. I found that in Derby 10.5.1.1 in release notes there is a note about DERBY-3319, which
>     states that "Users must call commit() or rollback(), or use auto-commit, before attempting to close a connection with
>     uncommitted operations." But I am executing just "select" statement, do I still need to call rollback or commit?
>
>     P;ease, advice,
>     --
>     Egidijus
>
>

Re: Closing connection result with exception

Posted by "Sakthivel.P" <p....@gmail.com>.
10.7.1.1 <http://db.apache.org/derby/releases/release-10.7.1.1.cgi> is
latest version. Please download and use.

http://db.apache.org/derby/derby_downloads.html

refer this issue for more details
https://issues.apache.org/jira/browse/DERBY-3806

- Sakthivel

On Fri, Feb 11, 2011 at 3:32 PM, Egidijus Vaisnora <
egidijus.vaisnora@nomagic.com> wrote:

> Hello All,
>
>        I am using Embedded Derby and whenever I attempt to close connection
> I got "Cannot close a connection while a transaction is still active."
> error.
>        I am using Derby 10.5.3. I found that in Derby 10.5.1.1 in release
> notes there is a note about DERBY-3319, which states that "Users must call
> commit() or rollback(), or use auto-commit, before attempting to close a
> connection with uncommitted operations." But I am executing just "select"
> statement, do I still need to call rollback or commit?
>
> P;ease, advice,
> --
> Egidijus
>