db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From digi_pixel <napper...@gmail.com>
Subject Re: SqlException With Returning Data For First Row
Date Wed, 05 Dec 2007 22:30:41 GMT

Problem was solved by using the correct reference to the ResultSet. Basically
a ResultSet is always returned even if there are no results returned for the
executeQuery method (ie rows).

Rick Hillegas-2 wrote:
> digi_pixel wrote:
>> By the way I was trying to retrieve the column using index 0. I have
>> attempted to re run the application by changing the index to 1 this time,
>> however a new run time error now appears:
>>     org.apache.derby.client.am.SqlException: Invalid operation to read at
>> current cursor position.
>> Rick Hillegas-2 wrote:
>>> Without seeing your code, I can only speculate about what the problem 
>>> is. However, your problem may be that you are trying to retrieve the 
>>> first column using the index 0. Annoyingly, the JDBC methods use 
>>> 1-based, not 0-based indexing. So the first thing to verify is that you 
>>> are retrieving the initial column using index 1, not 0.
>>> Hope this helps,
>>> -Rick
> Maybe you are positioned before the first row or after the last row. 
> Make sure that you issue a ResultSet.next() call before trying to 
> retrieve the first row. In general, make sure that ResultSet.next() 
> evaluates to true before each row that you read. When ResultSet.next() 
> returns false, you are at the end of the data and you will get an 
> exception if you try to read past the end.
> Hope this helps,
> -Rick

View this message in context: http://www.nabble.com/SqlException-With-Returning-Data-For-First-Row-tf4952206.html#a14182065
Sent from the Apache Derby Users mailing list archive at Nabble.com.

View raw message