db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mamta Satoor <msat...@gmail.com>
Subject Re: ResultSet updateRow() error
Date Thu, 01 Dec 2005 17:21:25 GMT
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 that
is happening w/o looking at a self-contained reproducible program.

Mamta


On 12/1/05, Danny <danny.gallagher@gainergroup.com> wrote:
>
> Sounds similar to my issue.
>
> From JIRA comments:
> I think the current behaviour is correct. After a commit the result set is
> 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, or
> is it the JDBC standard?
>
> The bug 4515 (Cloudscape bug tracking system) 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 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
> > <mailto:danny.gallagher@gainergroup.com>> wrote:
> >
> >
> > Derby version = 10.1.2.1 <http://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 = 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
> >
> >
> >
> >
>
>
>
>

Mime
View raw message