List of usage examples for javax.sql.rowset CachedRowSet setType
void setType(int type) throws SQLException;
RowSet
object to the given type. From source file:com.oracle.tutorial.jdbc.CoffeesFrame.java
public CachedRowSet getContentsOfCoffeesTable() throws SQLException { CachedRowSet crs = null; try {// w ww. j ava2s . c om 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; }