List of usage examples for javax.sql.rowset JdbcRowSet updateFloat
void updateFloat(int columnIndex, float x) throws SQLException;
float
value. From source file:com.oracle.tutorial.jdbc.JdbcRowSetSample.java
public void testJdbcRowSet() throws SQLException { JdbcRowSet jdbcRs = null; ResultSet rs = null;//from w w w.java 2s. co m Statement stmt = null; try { // An alternative way to create a JdbcRowSet object // stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); // rs = stmt.executeQuery("select * from COFFEES"); // jdbcRs = new JdbcRowSetImpl(rs); // Another way to create a JdbcRowSet object // jdbcRs = new JdbcRowSetImpl(); // jdbcRs.setCommand("select * from COFFEES"); // jdbcRs.setUrl(this.settings.urlString); // jdbcRs.setUsername(this.settings.userName); // jdbcRs.setPassword(this.settings.password); // jdbcRs.execute(); jdbcRs = new JdbcRowSetImpl(con); jdbcRs.setCommand("select * from COFFEES"); jdbcRs.execute(); jdbcRs.absolute(3); jdbcRs.updateFloat("PRICE", 10.99f); jdbcRs.updateRow(); System.out.println("\nAfter updating the third row:"); CoffeesTable.viewTable(con); jdbcRs.moveToInsertRow(); jdbcRs.updateString("COF_NAME", "HouseBlend"); jdbcRs.updateInt("SUP_ID", 49); jdbcRs.updateFloat("PRICE", 7.99f); jdbcRs.updateInt("SALES", 0); jdbcRs.updateInt("TOTAL", 0); jdbcRs.insertRow(); jdbcRs.moveToInsertRow(); jdbcRs.updateString("COF_NAME", "HouseDecaf"); jdbcRs.updateInt("SUP_ID", 49); jdbcRs.updateFloat("PRICE", 8.99f); jdbcRs.updateInt("SALES", 0); jdbcRs.updateInt("TOTAL", 0); jdbcRs.insertRow(); System.out.println("\nAfter inserting two rows:"); CoffeesTable.viewTable(con); jdbcRs.last(); jdbcRs.deleteRow(); System.out.println("\nAfter deleting last row:"); CoffeesTable.viewTable(con); } catch (SQLException e) { JDBCTutorialUtilities.printSQLException(e); } finally { if (stmt != null) stmt.close(); this.con.setAutoCommit(false); } }