The IOM
driver is the only SAS driver that supports updating ResultSets. For
this driver, you must form the result set in one of the following
ways:
-
Call the proprietary method MVAStatement.getTable(String
libref, String tableName).
-
Call Statement.executeQuery with
the explicit syntax “select * from
table” where
table must
be in one of these forms:
With this form, the
libref WORK is automatically prefixed to the table name.
With this form, standard
SQL elements such as joins, clauses, and column lists are not supported.
The following
code sample shows the syntax that is different from basic JDBC and
that is relevant to getting a result set that can be updated:
import com.sas.rio.MVAResultSet;
import com.sas.rio.MVAStatement;
/* This feature is available with IOM only. */
Class.forName("com.sas.rio.MVADriver");
connection = DriverManager.getConnection(
"jdbc:sasiom://hostname:port", props);
stmt = (MVAStatement) connection.createStateent(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
resultSet = stmt.getTable("libref", "tableName");
/* assume that table has cols Name and Age */
resultSet.absolute(5);
resultSet.updateString("name", "jdoe");
resultSet.updateInt("age", 34);
resultSet.updateRow();