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 = 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