# OpenLink JDBC 3.0 Cached RowSet Demonstration

This is a demonstration of an applet using OpenLink Software's JDBC(tm) 3.0 Driver with the JDBC 3.0 specification.

## Starting

When the Web browser has finished loading the Java applet, a window containing the JDBC applet will appear:

## Running a Query

When it is running, click on the "Execute" button, it will execute a SQL query against the default connection URL and populate this CachedRowSet object with data. The current contents of the rowset are discarded. If there are outstanding updates, they are also ignored. It will closes any database connections that it creates. If successful, you should see the first row of the resultset filling the applet window:

The "Accept" button will propagate all row update, insert, and delete changes to a data source. When successful, it replaces the original value of the rowset with the current value.

Click on the "Next" button to retrieve the next row, "Previous" to go back a row, "First" to move directly to the first row, and "Last" to move to the last row.

Clicking "Delete" will delete the current row from this rowset. It will mark the current row as deleted, but it does not delete the row from the underlying data source. The button "Accept" must be clicked to delete the row in the data source.

Clicking on "Refresh" will set the current row with its original value and marks the row as not updated, thus undoing any changes made to the row since the last call to the "Update" or "Delete".

Clicking on "Insert" will insert the contents of the insert row into this rowset following the current row. It will mark the current row as inserted, but it does not insert the row to the underlying data source. The button "Accept" must be clicked to insert the row to the data source.

Clicking on "Update" will mark the current row of this rowset as updated but it does not update the row to the underlying data source. The button "Accept" must be clicked to update the row to the data source. To move to a particular position in the resultset, enter that position into the edit box and click the "Absolute" button.

The "Relative" button will move the cursor position forwards or backwards by the number of rows specified in the edit box. To move backwards, enter a negative number.

The "CancelDelete" button will cancel deletion of the current row and the current row is no longer marked for deletion.

The "CancelInsert" button will cancel insertion of the current row and the current row is immediately removed from the rowset. This operation cannot be undone.

The "CancelUpdate" button may be clicked before clicking on "Update" to rollback the updates made to a row. If no updates have been made or "Update" has already been clicked, then this button has no effect.

The "SetOriginal" button will marks all rows in this rowset as being original rows. Any updates made to the rows become the original values for the rowset. It cannot be reversed.

The "SetOriginalRow" button will marks the current row in this rowset as being an original row. The row is no longer marked as inserted, deleted, or updated, and its values become the original values. It cannot be reversed.

The "RestoreOriginal" button will restore the rowset to its original state (the original value of the rowset becomes the current value). All updates, inserts, and deletes made to the original state are lost. The cursor is positioned before the first row.

## Changing the connection URL

To change the connection URL, select "File|Set Connection URL.." from the menu. A dialog box will appear enabling you to change the connection URL, as well as the driver to use:

Please note that due to the applet security restrictions, it is only possible to connect to the same server host as the Web server.