import java.sql.*; import java.lang.*; import java.io.*; class Ex_8_5_1_f { public static void main(String[] argv) throws Exception { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection( "jdbc:mysql://amigo/rolf?user=rolf&password=rolf"); Statement stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); conn.setAutoCommit(false); conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); ResultSet uprs = stmt.executeQuery("SELECT * FROM PC"); // Note: for updatable resultsets, only SELECT from one table, // Selected rows must include all primary keys (a primary key // must therefore exist in table). while (uprs.next()){ uprs.updateInt("price", uprs.getInt("price") - 100); uprs.updateRow(); } conn.commit(); } }