Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
JDBC and Relational Databases
SQL Exception: Cursor state not valid
Dominic Steng�rd
Ranch Hand
Posts: 186
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hey fellow javacoders!
Im running
JDBC
on top of a DB2 database.
When I run the following code:
private boolean validateResultSetData(ResultSet rs) { try { while(rs.next()) { double var4 = rs.getDouble(4); double var3 = rs.getDouble(3); int var2 = rs.getInt(2); String var1 = rs.getString(1).trim(); // Do something to collected data ... } rs.beforeFirst(); } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage( )); LOGGER.error("Error occured while quering database", e); } return true; }
I get the following error when rs.beforeFirst() is executed:
SQL Exception: Cursor state not valid.
Have you guys got any thoughts on why this is happening and how to solve it?
Thanks in advance!
Kind regards
[ March 08, 2008: Message edited by: Dominic Steng�rd ]
Dominic Steng�rd<br />Sun Certified Java 2 Programmer
Herman Schelti
Ranch Hand
Posts: 387
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi Dominic,
rs.beforeFirst();
Check DB2's documentation if it supports this at all.
Lookign at your code, I think you don't need this line anyway.
Herman
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
org.springframework.jdbc.UncategorizedSQLException
Problem getting the number of rows in a ResultSet
JDBC using ResourceBundle Class Problem
Invalid cursor state exception
a easy question please help !!!
More...