Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

scrollable result set, but still an error

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
*I know this may look like a repeat post at first glance, but I assure you it is not. I've read all the posts in this forum already.*
Okay, the end goal here is to use the .last() method of the java.sql.ResultSet(). I realize that in order to use this you must have a scrollable resultset, which I have already specified as you can see in the code below. A few items of interest: We're using
JDK 1.2.2 (don't ask why)
Oracle 8i
Here's the code:
Connection objConn = null;
OracleCallableStatement objStmt = null;
objConn = SNTS_CConnection.open();
objStmt = (OracleCallableStatement)objConn.prepareCall("{? = call
SCHEMA.TABLE.SPROC (?,?)}",
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
objStmt.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);
objStmt.setString(2, strSomething);
objStmt.setString(3, strSomethingElse);
objStmt.execute();
rs = (ResultSet)objStmt.getObject(1);
rs.next(); //having or not having this line makes no difference
if (m_rsResults.last()) //BREAKS HERE
{
//nice code
}
Now, on the line that is commented as breaking above i receive this error at runtime:
"oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
java.sql.SQLException
Invalid operation for forward only resultset : last "
It should also be noted that the SQL code in the sproc works fine if embedded directly into the java.
As you can see, I've used the TYPE_SCROLL_INSENSITIVE (and the CONCUR_READ_ONLY for that matter) and I'm still receiving the error. Any help would be greatly appreciated!!
Thanks in advance,
bryan
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bryan,
I'm only guessing, but it appears that a "ref cursor" returned from an Oracle stored procedure cannot be scrollable.
Have you tried searching the following Web sites:
http://technet.oracle.com
http://asktom.oracle.com
http://metalink.oracle.com
Have you checked the Oracle documentation? It may verify that "ref cursors"s cannot be scrollable.
Oracle documentation available from:
http://tahiti.oracle.com
Hope this helps.
Good Luck,
Avi.
 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again,
Upon further review of the Orcale 8.1.6.0.0 documentation, it is very clear that scrollable resultsets can indeed be used in this version. In fact, I have gotten them to work quite nicely...however, the problem here is that I'm using a stored procedure as well (see code above).
So the ultimate question here is:
Using JDBC 2.0, and the Oracle 8.1.6.0.0 (or the latest 8.1.7.1) drivers, and jdk 1.2.2: Can a scrollable resultset (ref cursor) be returned from an Oracle stored procedure?
I have scanned all of the documentation listed above...thanks for the resources...but have come up dry. Surely someone must know this answer?Many thanks to all who try!
bryan
 
reply
    Bookmark Topic Watch Topic
  • New Topic