Hello,
Allmost the same code.
import java.sql.*;
public class Main {
public static void main(String[] args) {
try {
Class.forName("com.sap.dbtech.jdbc.DriverSapDB");
} catch (ClassNotFoundException e) {
};
Connection c;
try {
c =
DriverManager.getConnection(
"jdbc:sapdb://localhost/ERP_DEV",
"dba",
"dba");
Statement s =
c.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = s.executeQuery("select * from erp_stock");
while (rs.next()) {
System.out.print(rs.getString(1));
System.out.print(" ");
System.out.println(rs.getString(2));
}
rs.moveToInsertRow();
rs.updateInt(1, 0);
rs.updateString(2, "Nauja reiskme1002");
rs.updateNull(3);
rs.updateNull(4);
rs.updateNull(5);
rs.insertRow();
rs.last(); // Here is the problem
System.out.print(rs.getString(1));
System.out.print(" ");
System.out.println(rs.getString(2));
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
}
Error code: The method cancelRowUpdates cannot be called while positioned at
the insert row.
Expected behavior:
"After you have called the method insertRow , you can start building another
row to be inserted, or you can move the cursor back to a result set row. You
can, for instance, invoke any of the methods that put the cursor on a
specific row, such as first , last , beforeFirst , afterLast , and absolute
. You can also use the methods previous , relative , and moveToCurrentRow .
Note that you can invoke moveToCurrentRow only when the cursor is on the
insert row."
from
http://java.sun.com/docs/books/tutorial/jdbc/jdbc2dot0/inserting.html
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general