Hi Andrius, your problem is that using the next() calls in the while loop, you have been fetching through the complete result set, especially you are positioned after the last row, which does really not need any refresh ...
Replacing the 'while' with an 'if' will possibly work. You will not get any 'illegal row' exception cause JDBC says so (I assume they thought about calling refreshRow()) to get more rows into a (possibly even empty) result set). Regards Alexander Schr�der SAP Labs Berlin > -----Original Message----- > From: Andrius Vilciauskas [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 11, 2003 10:31 AM > To: [EMAIL PROTECTED] > Subject: need some explanation on jdbc > > > Hello, > > Is this code correct ? If so why I don's see changes ? > If see changes only if I restart program. > > import java.sql.*; > > > import exco.erp.db.Database; > > public class Main { > > /** > * Constructor for Main. > */ > public Main() { > super(); > try { > > Database db = new Database(); > Connection c = db.getConnection(); > > Statement st = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, > ResultSet.CONCUR_UPDATABLE); > ResultSet rs = st.executeQuery("select * from > ERP_PURCHASE_ORDERS_LINES > where id=160"); > > while (rs.next()) System.out.println(rs.getString(5)); > } > > Statement st2 = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, > ResultSet.CONCUR_UPDATABLE); > > st2.executeUpdate("update ERP_PURCHASE_ORDERS_LINES set > quantity=5 where > id=160"); > > rs.refreshRow(); > System.out.println(rs.getString(5)); > // I don't see any changes. It's looks like refreshRow down't work > > c.commit(); > > } catch (SQLException e) { > System.out.print("Klaida: "); > System.out.println(e.getMessage()); > } > > } > > public static void main(String[] args) { > Main m = new Main(); > > } > } > > > > _______________________________________________ > 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
