![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 343
Rep Power: 4
![]() |
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.
|
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 343
Rep Power: 4
![]() |
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); |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |