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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
JDBC and Relational Databases
SQL Exception: Cursor state not valid
Dominic Steng�rd
Ranch Hand
Posts: 186
posted 16 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 16 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
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
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...