Hello,

I've got the same problem...
Another problem for me in that background:
How to make the inserted row visible in this ResultSet.
Is there currently a possible way to integrate the inserted row in a filled
ResultSet (SAP DB 7.3 or 7.4)?
If I create a Statement as ResultSet.TYPE_SCROLL_SENSITIVE, no changes are
visible(7.3).

Regards,
Kolja

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]Im Auftrag von Andrius
Vilciauskas
Gesendet: Freitag, 3. Januar 2003 13:50
An: [EMAIL PROTECTED]
Betreff: and another possible bug in jdbc driver


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


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to