Monday, November 30, 2009

Invalid operation for read only resultset

Invalid operation for read only resultset

Sometimes when running select queries you will get the following error message in JDBC

Invalid operation for read only resultset


The possible reasons and solutions are

Result Set Limitations

The following limitations are placed on queries for enhanced result sets. Failure to follow these guidelines will result in the JDBC driver choosing an alternative result set type or concurrency type.

To produce an updatable result set:

* A query can select from only a single table and cannot contain any join operations.

In addition, for inserts to be feasible, the query must select all non-nullable columns and all columns that do not have a default value.
* A query cannot use "SELECT * ". (But see the workaround below.)
* A query must select table columns only. It cannot select derived columns or aggregates such as the SUM or MAX of a set of columns.

To produce a scroll-sensitive result set:

* A query cannot use "SELECT * ". (But see the workaround below.)
* A query can select from only a single table.

No comments:

Post a Comment