JDBC Tutorial
JDBC RowSets RowSets are snapshot of the SQL Query. RowSets are stored in the memory. Which supports Updatable Rows, Scrollable ResultSets. javax.sql package has RowSet Interface. This interface adds support to JavaBeans style Interface for the JDBC API. Some of the RowSets are connection oriented, some of them are disconnected oriented. In Distributed Applications or Multitier Applications where each layer is hosted in different machines, for ex: Web Applications which works in Disconnected Apporach, Rowsets are best suited in Multi-tier Applications.
RowSetFactory factory = RowSetProvider.newFactory(); JdbcRowSet jdbcRowSet = factory.createJdbcRowSet(); jdbcRowSet.setCommand("SELECT * FROM EMP"); jdbcRowSet.setUrl("jdbc:oracle:thin:@localhost:1521/XE"); jdbcRowSet.setUsername("scott"); jdbcRowSet.setPassword("tiger"); jdbcRowSet.execute(); while(jdbcRowSet.next()) { System.out.println( jdbcRowSet.getInt(1)+" "+jdbcRowSet.getString(2)+" "+ jdbcRowSet.getFloat("SAL")+" "+jdbcRowSet.getDate("HIREDATE") ); }
ADS