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 Veaceslav Chicu <cs...@infologic.fr> on 2005/11/17 14:40:35 UTC

ResultSet holdability

Hello,

conn.setAutoComit(true);

I have a unsensitive readonly result set:
conn.prepareStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT))
...

after that I execute a stored procedure:
conn.prepareCall("{call procedure(?, ?, ?)}")
...

if I have an exception in my procedure, first resultSet will close?
normaly in my client application I shoud reexecute my select?


thank you,
Slavic
P.S. I have a JTable that shows results of un select, I have a button
that execute a stored procedure, normaly if procedure fails it should'nt
affect my select

Re: ResultSet holdability

Posted by Veaceslav Chicu <cs...@infologic.fr>.
hello,

thank you for answers
I'm in embeded mode

exception in procedure is created like this
throw new SQLException("reason", "38002");

so if I look in my app I see sqlcode=38002 , severity=20000

it close my result set

best regards,
Slavic

Dag H. Wanvik wrote:
> Hi,
> 
> Veaceslav Chicu wrote:
> 
> :
> 
>>if I have an exception in my procedure, first resultSet will close?
>>normaly in my client application I shoud reexecute my select?
> 
> 
>>>>>>"Satheesh" == Satheesh Bandaram <sa...@Sourcery.Org> wrote:
> 
> Satheesh> 
> Satheesh> Are you using embedded driver or network driver? Wonder if this is:
> Satheesh> http://issues.apache.org/jira/browse/DERBY-694
> 
> If the call fails with transaction severity (see
> http://db.apache.org/derby/docs/10.1/devguide/cdevconcepts844813.html),
> a rollback will ensue and the rollback will close the result set (even
> if holdability is HOLD_CURSORS_OVER_COMMIT). If it fails with
> statement severity, the transaction should not be rolled back and the
> result set should remain open. So, if you have a statement level exception
> *and* you are using the the network driver, it could be DERBY-694. 
> 
> Dag
> 


Re: ResultSet holdability

Posted by Veaceslav Chicu <cs...@infologic.fr>.
maybe this is the answer?
if an rollback occurs all statements are closed


http://db.apache.org/derby/docs/10.1/devguide/rdevconceptsholdablecursors.html

When a rollback occurs either explicitly or implicitly, the following
behavior applies:

    * All open ResultSets are closed.
    * All locks acquired during the unit of work are released.

best regards,
Slavic


Dag H. Wanvik wrote:
> Hi,
> 
> Veaceslav Chicu wrote:
> 
> :
> 
>>if I have an exception in my procedure, first resultSet will close?
>>normaly in my client application I shoud reexecute my select?
> 
> 
>>>>>>"Satheesh" == Satheesh Bandaram <sa...@Sourcery.Org> wrote:
> 
> Satheesh> 
> Satheesh> Are you using embedded driver or network driver? Wonder if this is:
> Satheesh> http://issues.apache.org/jira/browse/DERBY-694
> 
> If the call fails with transaction severity (see
> http://db.apache.org/derby/docs/10.1/devguide/cdevconcepts844813.html),
> a rollback will ensue and the rollback will close the result set (even
> if holdability is HOLD_CURSORS_OVER_COMMIT). If it fails with
> statement severity, the transaction should not be rolled back and the
> result set should remain open. So, if you have a statement level exception
> *and* you are using the the network driver, it could be DERBY-694. 
> 
> Dag
> 


Re: ResultSet holdability

Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
Hi,

Veaceslav Chicu wrote:

:
>if I have an exception in my procedure, first resultSet will close?
>normaly in my client application I shoud reexecute my select?

>>>>> "Satheesh" == Satheesh Bandaram <sa...@Sourcery.Org> wrote:
Satheesh> 
Satheesh> Are you using embedded driver or network driver? Wonder if this is:
Satheesh> http://issues.apache.org/jira/browse/DERBY-694

If the call fails with transaction severity (see
http://db.apache.org/derby/docs/10.1/devguide/cdevconcepts844813.html),
a rollback will ensue and the rollback will close the result set (even
if holdability is HOLD_CURSORS_OVER_COMMIT). If it fails with
statement severity, the transaction should not be rolled back and the
result set should remain open. So, if you have a statement level exception
*and* you are using the the network driver, it could be DERBY-694. 

Dag

Re: ResultSet holdability

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
Are you using embedded driver or network driver? Wonder if this is:
http://issues.apache.org/jira/browse/DERBY-694

Satheesh

Veaceslav Chicu wrote:

>Hello,
>
>conn.setAutoComit(true);
>
>I have a unsensitive readonly result set:
>conn.prepareStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
>ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT))
>...
>
>after that I execute a stored procedure:
>conn.prepareCall("{call procedure(?, ?, ?)}")
>...
>
>if I have an exception in my procedure, first resultSet will close?
>normaly in my client application I shoud reexecute my select?
>
>
>thank you,
>Slavic
>P.S. I have a JTable that shows results of un select, I have a button
>that execute a stored procedure, normaly if procedure fails it should'nt
>affect my select
>
>
>
>  
>