Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 90020 invoked from network); 2 Dec 2005 23:46:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Dec 2005 23:46:13 -0000 Received: (qmail 97201 invoked by uid 500); 2 Dec 2005 23:46:07 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 95893 invoked by uid 500); 2 Dec 2005 23:45:57 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 95092 invoked by uid 99); 2 Dec 2005 23:45:49 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Dec 2005 15:45:49 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of msatoor@gmail.com designates 64.233.184.203 as permitted sender) Received: from [64.233.184.203] (HELO wproxy.gmail.com) (64.233.184.203) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Dec 2005 13:42:17 -0800 Received: by wproxy.gmail.com with SMTP id i12so749556wra for ; Fri, 02 Dec 2005 13:40:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=hEyJ7hin+lyWr8TPkOP+0MU1rAMFU1ikPhGYm3RYURyYA9pt5fplhDQgL/jh2fW5j9TlKFseF+p8J6TH3+HSmpBMFnZ/99CYNWO9WQ4BhNhsXVJdBb3v8E+MAX8xJJJQEbz6L2wzDY70+7OwODOvs2eb8tuEpgsWBMeqwQ12dYE= Received: by 10.54.135.10 with SMTP id i10mr752146wrd; Fri, 02 Dec 2005 13:40:26 -0800 (PST) Received: by 10.54.133.2 with HTTP; Fri, 2 Dec 2005 13:40:25 -0800 (PST) Message-ID: Date: Fri, 2 Dec 2005 13:40:25 -0800 From: Mamta Satoor To: Derby Discussion Subject: Re: ResultSet updateRow() error In-Reply-To: <20051202195514.9F80010FF244@asf.osuosl.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1866_7317922.1133559625828" References: <20051202195514.9F80010FF244@asf.osuosl.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_1866_7317922.1133559625828 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Danny, Looking at the insert sql and the program, looks like only one row will qualify for SELECT transactiontest.idnumber, transactiontest.name FROM transactiontest WHERE transactiontest.idnumber =3D 1 FOR UPDATE And that is why I think you get the resultset closed when you do commit and then try to do a next. If you had another row that qualified for the select statement, next would have taken you to that row. Mamta On 12/2/05, Danny wrote: > > It is the ClientDriver that I am using. > > > > Program is attached, as is it updates, if you uncomment the commit and > next, you get result set is closed, which is different > > than the error I was getting before, nonetheless. > > > > Also, table create: > > > > CREATE TABLE transactiontest > > ( > > idnumber SMALLINT NOT NULL, > > name VARCHAR(35), > > > > PRIMARY KEY (idnumber) > > ); > > > > INSERT INTO TRANSACTIONTEST VALUES(1, 'TEST NAME 1'); > > INSERT INTO TRANSACTIONTEST VALUES(2, 'TEST NAME 2'); > > INSERT INTO TRANSACTIONTEST VALUES(3, 'TEST NAME 3'); > > INSERT INTO TRANSACTIONTEST VALUES(4, 'TEST NAME 4'); > > > > Danny Gallagher > > The Gainer Group > > 6525 The Corners Parkway > > Suite 215 > > Norcross Ga, 30092 > > > > > ------------------------------ > > *From:* Mamta Satoor [mailto:msatoor@gmail.com] > *Sent:* Thursday, December 01, 2005 12:21 PM > *To:* Derby Discussion > *Subject:* Re: ResultSet updateRow() error > > > > Hi Danny, > > > > The behavior you are noticing about cursor not positioned on a row after > commit is documented in Derby Developer's Guide 10.1 at http://db.apache.= org/derby/docs/10.1/devguide/cdevconcepts29416.html > > > Looks at subsection Cursors. > > "A cursor declared to be held across commit can execute updates and issue > multiple commits before closing the cursor, but the cursor must be > repositioned before any statement following the commit." > > > > As for you not being able to reposition with a next, I don't know why tha= t > is happening w/o looking at a self-contained reproducible program. > > > > Mamta > > > > On 12/1/05, *Danny* wrote: > > Sounds similar to my issue. > > From JIRA comments: > I think the current behaviour is correct. After a commit the result set i= s > > open but is not positioned on a row. The result set must be re-positioned > with a next() or other method before acessing a row or modifying it with = a > positioned update or delete. I think this may be from the SQL standard, o= r > > is it the JDBC standard? > > The bug 4515 (Cloudscape bug tracking system) was fixed, I think to retur= n > the correct error as you are seeing. > > So I tried calling next() again after the commit but before the call to > updateRow() to reposition the cursor, no luck, same error: > Invalid cursor state - no current row. > > Danny Gallagher > The Gainer Group > 6525 The Corners Parkway > Suite 215 > Norcross Ga, 30092 > > > -----Original Message----- > From: Fernanda Pizzorno [mailto:Fernanda.Pizzorno@Sun.COM] > Sent: Thursday, December 01, 2005 3:59 AM > To: Derby Discussion > Subject: Re: ResultSet updateRow() error > > It appears to me that the behavior you are seeing is similar to that of > JIRA 610 (http://issues.apache.org/jira/browse/DERBY-610), except that > you are using updateRow and not positioned update. Is that the case? > > Fernanda > > Danny wrote: > > > I figured out what the problem was, although, I am not sure why the > > behavior seems to be implemented the way it is. > > > > Between the time that I was calling the update methods on the columns > > and the call to updateRow() a commit was being executed. > > > > It seems that this invalidated the current row somehow, I could still > > get the values from the columns with the get methods, so the entire > > ResultSet object wasn't hosed, but the cursor seems to be. > > > > Since the ResultSet was created with > > ResultSet.HOLD_CURSORS_OVER_COMMIT, I don't understand why it behaves > > this way. > > > > Danny Gallagher > > > > The Gainer Group > > > > 6525 The Corners Parkway > > > > Suite 215 > > > > Norcross Ga, 30092 > > > > -----------------------------------------------------------------------= - > > > > > *From:* Mamta Satoor [mailto:msatoor@gmail.com] > > *Sent:* Tuesday, November 29, 2005 2:00 PM > > *To:* Derby Discussion > > *Subject:* Re: ResultSet updateRow() error > > > > Hi Danny, > > > > The scenario you described should work. Can you provide a simple > > reproducible program for this(along with the table and index creation? > > > > Mamta > > > > On 11/29/05, *Danny* < danny.gallagher@gainergroup.com > > > wrote: > > > > > > Derby version =3D 10.1.2.1 > > > > I cannot seem to figure out why this ResultSet update is not working. > > > > I create the ResultSet with the following: > > > > Statement stmt =3D conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, > > ResultSet.CONCUR_UPDATABLE, ResultSet.HOLD_CURSORS_OVER_COMMIT); > > > > The query that I execute to return the result set contains the primary > > key, > > FROM contains only one table, and the query contains no JOINS or UNIONS= . > > > > So then I call next() > > Update all the columns that I am interested in updating, up to this > point > > everything is fine, I can get the column that I updated out, and the > > values > > are the updated ones. > > > > When I call updateRow(), I get: Invalid cursor state - no current row > > > > But there is a current row, I am updating columns in it and those > updates > > are taking place. > > > > Any help is appreciated. > > Thanks > > > > Danny Gallagher > > The Gainer Group > > 6525 The Corners Parkway > > Suite 215 > > Norcross Ga, 30092 > > > > > > > > > > > > > ------=_Part_1866_7317922.1133559625828 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Danny,
 
Looking at the insert sql and the program, looks like only one row wil= l qualify for
SELECT transactiontest.idnumber, transactiontest.name FROM transactiontest WHERE transactiontest.idnu= mber =3D 1 FOR UPDATE
And that is why I think you get the resultset closed when you do commi= t and then try to do a next. If you had another row that qualified for the = select statement, next would have taken you to that row.
 
Mamta

 
On 12/2/05, = Danny <danny.gall= agher@gainergroup.com> wrote:

It is the ClientDriver that I am us= ing.

 

Program is attached, as is it updat= es, if you uncomment the commit and next, you get result set is closed, whi= ch is different=20

than the error I was getting before= , nonetheless.

 

Also, table create:

 

CREATE TABLE transactiontest=

(

    idnumber &n= bsp;          SMALLINT NOT NUL= L,

    name  =             &nb= sp; VARCHAR(35),

 

    PRIMARY KEY (idn= umber)

);

 

INSERT INTO TRANSACTIONTEST VALUES(= 1, 'TEST NAME 1');

INSERT INTO TRANSACTIONTEST VALUES(= 2, 'TEST NAME 2');

INSERT INTO TRANSACTIONTEST VALUES(= 3, 'TEST NAME 3');

INSERT INTO TRANSACTIONTEST VALUES(= 4, 'TEST NAME 4');

 

Danny Gallagher

The Gainer Group

6525 The Corners Parkway

Suite 215<= /font>

Norcross Ga, 30092

 

 


From: Mamt= a Satoor [mailto: msatoor@gmail.com]
Sent: Thursday, December 01, 2005 12:2= 1 PM=20


To: Derby Discussion
Subject: Re: ResultSet updateRow() error

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

On 12/1/05, Danny &= lt; danny.gallagher@gainergroup.com> wrote:

= Sounds similar to my issue.

From JIR= A comments:
I think the current behaviour is correct. After a commit the= result set is=20
open but is not positioned on a row. The result set must be re-position= ed
with a next() or other method before acessing a row or modifying it w= ith a
positioned update or delete. I think this may be from the SQL stan= dard, or=20
is it the JDBC standard?

The bug 4515 (Cloudscape bug tracking s= ystem) was fixed, I think to return
the correct error as you are seeing.=

So I tried calling next() again after the commit but before the cal= l to=20
updateRow() to reposition the cursor, no luck, same error:
Invalid c= ursor state - no current row.

Danny Gallagher
The Gainer Group6525 The Corners Parkway
Suite 215
Norcross Ga, 30092


-----Original Message-----
From: Fernanda Pizzorno [mailto:Fernanda.Pizzorno@Sun.COM]
Sent: Thu= rsday, December 01, 2005 3:59 AM
To: Derby Discussion
Subject: Re: ResultSet updateRow() error
It appears to me that the behavior you are seeing is similar to that ofJIRA 610 ( http://issues.apache.org/jira/browse/DERBY-610), except that
you are= using updateRow and not positioned update. Is that the case?

Ferna= nda

Danny wrote:

> I figured out what the problem was, alt= hough, I am not sure why the
> behavior seems to be implemented the way it is.
>
> Be= tween the time that I was calling the update methods on the columns
>= ; and the call to updateRow() a commit was being executed.
>
> = It seems that this invalidated the current row somehow, I could still
> get the values from the columns with the get methods, so the entir= e
> ResultSet object wasn't hosed, but the cursor seems to be.
&g= t;
> Since the ResultSet was created with
> ResultSet.HOLD_CURS= ORS_OVER_COMMIT , I don't understand why it behaves
> this way.
>
> Dann= y Gallagher
>
> The Gainer Group
>
> 6525 The Corne= rs Parkway
>
> Suite 215
>
> Norcross Ga, 30092
>
> ----------------------------------------------------------= --------------
>
> *From:* Mamta Satoor [mailto: msatoor@gmail.com]
> *Sent:* Tuesday, November 29, 2005 2:00 PM> *To:* Derby Discussion
> *Subject:* Re: ResultSet updateRow() = error
>
> Hi Danny,
>
> The scenario you described= should work. Can you provide a simple
> reproducible program for this(along with the table and index creat= ion?
>
> Mamta
>
> On 11/29/05, *Danny* < danny.gallagher@gainergroup.com
> <mailto:danny.gallagher@gainergroup.com>> = wrote:
>
>
> Derby version =3D 10.= 1.2.1 < http://10.1.2.1>
>
> I cannot seem to figure out why thi= s ResultSet update is not working.
>
> I create the ResultSet w= ith the following:
>
> Statement stmt =3D conn.createStatement (ResultSet.TYPE_FORWARD_ONLY,
> ResultSet.CONCUR_UPDATABLE, ResultSet= .HOLD_CURSORS_OVER_COMMIT);
>
> The query that I execute to ret= urn the result set contains the primary
> key,
> FROM contains= only one table, and the query contains no JOINS or UNIONS.
>
> So then I call next()
> Update all the columns that = I am interested in updating, up to this point
> everything is fine, I= can get the column that I updated out, and the
> values
> are= the updated ones.
>
> When I call updateRow(), I get: Invalid cursor state - no = current row
>
> But there is a current row, I am updating colum= ns in it and those updates
> are taking place.
>
> Any h= elp is appreciated.
> Thanks
>
> Danny Gallagher
> The Gainer Group> 6525 The Corners Parkway
> Suite 215
> Norcross Ga, 30092=
>
>
>
>



------=_Part_1866_7317922.1133559625828--