db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Segel <mse...@segel.com>
Subject Re: ResultSet updateRow() error
Date Thu, 01 Dec 2005 13:42:42 GMT
On Thursday 01 December 2005 6:19 am, Danny 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?
>
A simple test is that after a commit, dump the contents of the result set, and 
all suspected metadata.

See where its pointing to.

This isn't an SQL standard issue at all. You're dealing with the Java API.
It could be a bug, or a design issue in the JDBC driver though.

Connection, ResultSet are all interfaces thus how they are implemented is 
going to be driver specific.


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

This is actually an interesting problem. Its one where you're expecting one 
thing while the driver is doing something different. Only you don't know 
exactly what the driver did... ;-)

If I can get some time, I'll try to reproduce this behavior and then dump the 
meta data of the connection and the resultset to see where they are pointing.

Imagine doing a nested loop. The outer loop is fetching rows from table A.
For each row fetched, you have an inner loop that updates rows in table B.
After each set of updates you commit the work.

What happens to the result set that fetched work from table A?

So I guess its time to apply forensic ?sp? computing to determine what is 
actually happening... ;-)

But hey, what do I know? 
Its not like I get paid to reverse engineer poor code and complete their 
projects... ;-)

-Gumby

Mime
View raw message