Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need advice on using rowset

 
larry august
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 res.next()" 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
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic