|
Can you provide the code snippet? I'll try to help you out. The logical should look something like this (off the top of my head... but in the ballpark); Statement statement = connection.createStatement(ResultSet.updatable, ResultSet.scroll_sensitive); ResultSet rs = statement.executeQuery("select * from from somewhere"); // Must move onto a row... while (rs.next()) { rs.updateString(1, "Just walking along... clobbering data..."); rs.updateRow(); } rs.close(); statement.close(); Notes: - I believe the toolbox will not allow you to update through an insensitive cursor (native won't either). - If getXXX() works, you are on a row. You should be able to update that row assuming the ResultSet is updatable. Richard D. Dettinger iSeries Java Data Access Team Democracy's enemies have always underestimated the courage of the American people. It was true at Concord Bridge. It was true at Pearl Harbor. And it was true today. Rochester Post-Bulletin Tuesday September 11, 2001 |---------+----------------------------> | | "Mike Silvers" | | | <msilvers@hbs-inc| | | .com> | | | Sent by: | | | java400-l-admin@m| | | idrange.com | | | | | | | | | 05/10/2002 01:19 | | | PM | | | Please respond to| | | java400-l | | | | |---------+----------------------------> >-----------------------------------------------------------------------------------------------------------------------------| | | | To: <java400-l@midrange.com> | | cc: | | Subject: The Cursor State Not Valid is driving me crazy! | | | | | >-----------------------------------------------------------------------------------------------------------------------------| All, Before one of you says it, I know...the drive is not a long one :) I am having a problem when trying to update a file. I create a prepared statement with ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE. I then read the file and get a result back. I checked the cursor position and saw that the cursor is sitting on row #1. I make my changes to the values in the wrapper class. After the changes are made, I am going to update all the resultset fields. First, I check the row the cursor is on. It is still on row #1. I then try to update the resultset with the new values. Every time I try this, I get an error. The error is: Cursor state not valid. SQLError code: -99999 SQLError state: 24000 Stack Trace: java.sql.SQLException: Cursor state not valid. at com.ibm.as400.access.JDError.throwSQLException(JDError.java:296) at com.ibm.as400.access.AS400JDBCResultSet.beforeUpdate(AS400JDBCResultSet.java :2954) at com.ibm.as400.access.AS400JDBCResultSet.updateValue(AS400JDBCResultSet.java: 4487) at com.ibm.as400.access.AS400JDBCResultSet.updateBigDecimal(AS400JDBCResultSet. java:3310) at dataaccess.JDBCFileAccess.update(JDBCFileAccess.java:223) at dataaccess.JDBCFileAccess.main(JDBCFileAccess.java:548) I tried everything I could possible think of..... leaving the cursor where it sits, moving the cursor back, forward, to current row.... Nothing works! I get the same error every time...the stack dump is the same each time too. Any ideas??? Thanks! Mike ================================ Mike Silvers AS/400 Senior Programmer/Analyst AS/400 IBM Certified RPG IV Developer AS/400 IBM Certified Solutions Expert Hainey Business Systems 8 E. Canal St Dover, PA 17315 Branch Office: (410) 397-8739 Phone: (800) 932-3380 ext. 237 Fax: (717) 292-9474 Web: http://www.hbs-inc.com ________________________________ Providing E-Commerce, EDI, AS/400 Development, Java Development, and related services nationwide. ================================ _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.