Chapter 35 Advanced Database Programming
Section 35.3 Batch Processing
1. To add the SQL statement “insert into T values (100, ‘Smith’)” into the batch into a Statement stmt, use
a. stmt.add(“insert into T values (100, ‘Smith’)”);
b. stmt.add(‘insert into T values (100, ‘Smith’)’);
c. stmt.addBatch(“insert into T values (100, ‘Smith’)”);
d. stmt.addBatch(‘insert into T values (100, ‘Smith’)’);
#
2. Invoking executeBatch() returns .
a. an int value indicating how many SQL statements in the batch have been executed successfully.
b. a ResultSet
c. an array of counts, each of which counts the number of the rows affected by the SQL command.
d. an int value indicating how many rows are effected by the batch execution.
#
Section 35.4 Scrollable and Updateable Result Set
3. To obtain a scrollable or updateable result set, you must first create a statement using which of the following?
a. Statement statement = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
b. Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
c. Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
d. Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
#
4. In a scrollable and updateable result set, you can use methods on a result set.
a. first()
b. last()
c. insertRow()
d. deleteRow()
e. updateRow()
#
Section 35.5 RowSet, JdbcRowSet, and CachedRowSet
5. RowSet is an extension of .
a. Connection
b. Statement
c. ResultSet
d. CLOB
#
6. You can use a RowSet to .
a. set a database URL
b. set a database username