File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Need advice on using rowset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Need advice on using rowset" Watch "Need advice on using rowset" New topic

Need advice on using rowset

larry august

Joined: Jul 19, 2006
Posts: 2
Hi I have a problem I am trying to solve.

I have a postgreSQL table populated with data. Integers. I have used JDBC stuff before to get data out of the table. This time I need to only see one record at a time. The stuff I used before, the "while" queries all the records and displays all of them latter at bottom of code.

I need to know how to get it to show me only one record at a time. I have buttons on GUI that I will connect to this. A forward and back button.

Through searching I have come across hints to use a rowset. I also came across advice to use JdbcRowSet with java 1.5. I tried some examples but I am still getting back from eclipse error that the cursor type is forward only.

Here is what I have been trying

Error Message from eclipse
SQL Exception: PostgreSQL Connection Failed Operation requires a scrollable ResultSet, but this ResultSet is FORWARD_ONLY.

According to all the stuff I have found about the JdbcRowSet it is scrollable by default. I dont have to set it.

anyone have an idea? or another suggestion for what to use to navigate through the records one at a time?

Thanks for any help.
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

It might be a limitation of the Postgres drivers -- do you have the most recent drivers?

Failing that, you could always read the results into a List and then work with the data in the list (forward moves forward in the list, backwards move backward).

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: Need advice on using rowset
It's not a secret anymore!