|
I am running a Java program to retrieve, insert and update data on UDB DB2 on AS/400 using JDBC drivers. The program is consist of about 18 tasks/batches. I developed the program in VisualAge for Java 3.5. I run the same program on both NT and AS/400. On NT machine, I run test and debug (using AS/400 Toolbox for Java JDBC driver). On AS/400, I run the program as production (of course, use DB2 native JDBC driver). Because on AS/400, the program is much fast (about 30 times faster).
When the program try to update a field for a table, I have no problem run on NT (with VAJ), but I got error on AS/400. The error message is:
SQL error: Cursor SQLCURSOR000000003 not positioned on locked row.
And this error only occurs when the program run at the first time. If I run the same code one more time, the error is gone! But if the program hit another update point, the error will occur again and will gone if I run it second time.
My code segment looks like this (I only list that I think are related to the SQL operation):
.........
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery("select COLUMN1, COLUMN2 from table1 for update");
.........
rs.updateFloat("COLUMN2", aNumber);
rs.updateRow();
..........
Does anyone have any ideas?
Thanks.
Weining (Wayne) Xu
ALICO Information Systems & Technology
Wilmington, DE. USA
Phone: +302.594.2846 Fax: +302.594.2215
Email: weining.xu@aig.com
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.