This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes How to go to previous record Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to go to previous record" Watch "How to go to previous record" New topic
Author

How to go to previous record

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi
In Java I am using Oracle as my backend and I can go to next record, but I am not able to go to the previous record. I tried using rs.previous() method where rs is the object of ResultSet type but doesn't work. I heard about the setFecthDirection() method but how to use this I dont know.
If anyone of you knows please help me out.
Dharam
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You can only go backwards if the driver you are using fully supports JDBC 2.0. If I recall, the Oracle drivers are not fully JDBC 2.0 compliant. Check the Oracle web site for details of which functions are not supported.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
You can always keep a copy in your code, either of just the previous result, or of all the results in the resultset. Then you can traverse at will.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
You can use Connection.createStatement(int resultSetType, int resultSetConcurrency) method to create a scrollable ResultSet.
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
Originally posted by Thomas Paul:
You can only go backwards if the driver you are using fully supports JDBC 2.0. If I recall, the Oracle drivers are not fully JDBC 2.0 compliant. Check the Oracle web site for details of which functions are not supported.

FYI, Oracle drivers do have most of the JDBC 2.0 functionality.
http://technet.oracle.com//tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#_29_
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
of course, it depends on which drivers you are actually using.
------------------
Moderator of the JDBC Forum
 
GeeCON Prague 2014
 
subject: How to go to previous record