List of usage examples for javax.sql.rowset CachedRowSet setConcurrency
void setConcurrency(int concurrency) throws SQLException;
RowSet
object to the given concurrency level. From source file:com.oracle.tutorial.jdbc.CoffeesFrame.java
public CachedRowSet getContentsOfCoffeesTable() throws SQLException { CachedRowSet crs = null; try {/*from w w w . j a v a 2s. co m*/ connection = settings.getConnection(); crs = new CachedRowSetImpl(); crs.setType(ResultSet.TYPE_SCROLL_INSENSITIVE); crs.setConcurrency(ResultSet.CONCUR_UPDATABLE); crs.setUsername(settings.userName); crs.setPassword(settings.password); // In MySQL, to disable auto-commit, set the property relaxAutoCommit to // true in the connection URL. if (this.settings.dbms.equals("mysql")) { crs.setUrl(settings.urlString + "?relaxAutoCommit=true"); } else { crs.setUrl(settings.urlString); } // Regardless of the query, fetch the contents of COFFEES crs.setCommand("select COF_NAME, SUP_ID, PRICE, SALES, TOTAL from COFFEES"); crs.execute(); } catch (SQLException e) { JDBCTutorialUtilities.printSQLException(e); } return crs; }