FOR UPDATE worked! Thanks Dave!
Mike
----- Original Message -----
From: "Dave Wall" <dawall@us.ibm.com>
To: <java400-l@midrange.com>
Sent: Friday, May 10, 2002 3:36 PM
Subject: Re: The Cursor State Not Valid is driving me crazy!
>
> Try adding "FOR UPDATE" to your statement. Prior to a v5r1 PTF, the
server
> created updatable result sets only if the statement said FOR UPDATE.
After
> a debate with the server team when JDBC 2.0 came out, the Toolbox driver
> decided not to add "FOR UPDATE" to the application-supplied statement when
> the RS type was ResultSet.CONCUR_UPDATABLE. The theory was the driver
> shouldn't mess with the statement, and iSeries programmers are used to
> putting FOR UPDATE on their statements.
>
> After additional debate, we finally convinced the server team they needed
> to provide us an interface to create updatable cursors even though FOR
> UPDATE was not on the statement. They finally added that interface in a
> recent v5r1 PTF. The client side of that change is in JTOpen 3.1 (coming
> out next week).
>
> So, you can add FOR UPDATE, or get JTOpen 3.1 + a server PTF.
>
> David Wall
> Toolbox for Java
> iSeries ODBC Driver for Linux
>
>
>
>
> "Mike Silvers"
> <msilvers@hbs-inc To:
<java400-l@midrange.com>
> .com> cc:
> Sent by: Subject: The Cursor State
Not Valid is driving me crazy!
> java400-l-admin@m
> idrange.com
>
>
> 05/10/2002 01:19
> PM
> Please respond to
> java400-l
>
>
>
>
>
> 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.
>
>
>
>
>
>
> _______________________________________________
> 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.
>
>