Hello,

I think I have found a bug in jdbc driver

Bug description: Sample code stops working after inserting new row in empty
table
Database sheme:
CREATE TABLE ERP_PURCHASE_REQUESTS_LINES
(
 "ID"               Fixed (10,0)    DEFAULT  SERIAL (1),
 "PARENT_ID"               Fixed (10,0),
 "STOCK_ID"               Fixed (10,0),
 "QUANTITY"               Fixed (10,2),
 PRIMARY KEY ("ID")
)

Sample 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_PURCHASE_REQUESTS_LINES
where

parent_id = 7");

   while (rs.next()) {
    System.out.print(rs.getString(1));
    System.out.print(" ");
    System.out.println(rs.getString(2));
   }

   System.out.println("END.");

   Statement s2 = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,

ResultSet.CONCUR_UPDATABLE);
   s2.executeUpdate("insert into ERP_PURCHASE_REQUESTS_LINES (parent_id)
values (7)");
   rs.refreshRow();
   rs.last();
   System.out.println("New row ");
   System.out.print(rs.getString(1));
   System.out.print(" ");
   System.out.println(rs.getString(2));


  } catch (SQLException e) {
   System.out.println(e.getMessage());
  }
 }


}

Error message : Invalid argument value "row" = 0.

Or question: how to make new row visible in resultset ?



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

Reply via email to