Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 10th, 2008, 3:43 PM   #1
cwl157
Professional Programmer
 
Join Date: Feb 2005
Posts: 343
Rep Power: 4 cwl157 is on a distinguished road
Java JDBC in oracle 10g

I need to use the JDBC to access a database in Oracle 10g. I need to be able to go through the rows of a table more then once. I have created the ResultSet and ResultSetMetaData to retrieve the number of columns per row. I use a while loop to go through the ResultSet calling the next() method each time to get the next row. Then I print the rows. However, after I go through each row of the table once with the next() method of ResultSet, I need to go through the table from top to bottom again. Is there a method that will place the cursor that goes through the rows back at the top row? I looked up the ResultSet interface in the java documentation and it has a beforeFirst() method that will do just that, however when i put that in my program it compiles ok but when i try to run it I get an SQLException when trying to run the method. That tells me that java JDBC accepts it but Oracle 10g does not. If anyone is familar with this stuff do you know of a method that is compatible with Oracle 10g database that will take the cursor from the last row of the database and put it at the top so when the next() method is called in a while loop it will cycle through all the rows of the table a second time? Thanks.
cwl157 is offline   Reply With Quote
Old Apr 10th, 2008, 4:13 PM   #2
cwl157
Professional Programmer
 
Join Date: Feb 2005
Posts: 343
Rep Power: 4 cwl157 is on a distinguished road
Re: Java JDBC in oracle 10g

never mind i got it. It has to do with how the Statement is set up. You have to pass two fields into the Connection like this:

Statementstmt
=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
That will make the beforeFirst() method of ResultSet work
cwl157 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming with Java: Tutorial ReggaetonKing Java 7 May 20th, 2008 10:58 AM
Oracle 10g A.K.Al Shamsi Other Programming Languages 18 Apr 7th, 2008 12:51 PM
Jdbc evronia Java 5 Nov 28th, 2007 4:28 AM
problem with JDBC for talking to Microsoft Access database using a Java Applet captainK Java 4 Mar 20th, 2005 11:01 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:25 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC