You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Philippe Kruschitz <kr...@grid-it.at> on 2009/08/13 17:39:51 UTC

Problem with ResultSet

Hi list,

I am trying to embed a Derby database in a desktop application. When I 
run a query and then try to use the isBeforeFirst() method on the 
ResultSet I get back, I get following exception:

java.sql.SQLException: The 'isBeforeFirst' method is only allowed on 
scroll cursors.
         at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source)
         at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown 
Source)
Caused: java.sql.SQLException: The 'isBeforeFirst' method is only 
allowed on scroll cursors.
         at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source)
         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source)
         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source)
         at 
org.apache.derby.impl.jdbc.EmbedResultSet.checkScrollCursor(Unknown Source)
         at 
org.apache.derby.impl.jdbc.EmbedResultSet.checkRowPosition(Unknown Source)
         at 
org.apache.derby.impl.jdbc.EmbedResultSet.isBeforeFirst(Unknown Source)
         at at.grid.cms.user.CmsGroup.create(CmsGroup.java:67)

What does "The 'isBeforeFirst' method is only allowed on scroll 
cursors." exactly mean? Is that handled by the JDBC driver? (I'm using 
java.sql.ResultSet in my class)

I'm actually porting the application from PostgreSQL and it makes 
extensive use of the isBeforeFirst() method. I haven't really found a 
workaround yet, any ideas?

Am I missing something here?

Thanks a lot for your help!

Phil


Re: Problem with ResultSet

Posted by Bryan Pendleton <bp...@amberpoint.com>.
> What does "The 'isBeforeFirst' method is only allowed on scroll 
> cursors." exactly mean? 

A scrollable result set is one which you got by specifying TYPE_SCROLL_INSENSITIVE
or TYPE_SCROLL_SENSITIVE when you created it.

Here's some docs:

http://db.apache.org/derby/docs/10.5/devguide/cdevconcepts22641.html

thanks,

bryan