Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Invalid operation for read only resultset: updateInt

408534Nov 7 2003 — edited Nov 29 2003
The following method works with MySQL (TYPE = InnoDB).

private int returnIncrement(String strTableName) throws SQLException, ServiceException
{
serviceLocator.logEnter("ConfigureSQLDatabase", "returnIncrement");
int indexNumber = 0;
boolean blnRowFound = false;

Statement statement =
connectionSabbatical.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
resultSetSabbatical = statement.executeQuery("SELECT * FROM " + SQL.TABLE_SERVICES_INCREMENT);
resultSetSabbatical.beforeFirst();

while (resultSetSabbatical.next())
{
if (resultSetSabbatical.getString(1).equals(strTableName))
{
indexNumber = resultSetSabbatical.getInt(2) + 1;
resultSetSabbatical.updateInt(2, indexNumber);
resultSetSabbatical.updateRow();
resultSetSabbatical.last();
connectionSabbatical.commit();
blnRowFound = true;
}
}
if (blnRowFound)
serviceLocator.logDebug("ConfigureSQLDatabase", "returnIncrement", "Returning Index Number: " + indexNumber);
else
throw new SQLException("Record Not Found");

statement.close();
serviceLocator.logExit("ConfigureSQLDatabase", "returnIncrement");
return indexNumber;
}

However, Oracle returns ...

Nov 7, 2003: 9:58:52 PM: ConfigureSQLDatabase.selectSQL(): SQL EXCEPTION
Message: Invalid operation for read only resultset: updateInt
SQL State: null
Error Code: 17076

Any thoughts?

Thx,
Marvin Toll (MarvinToll@gtcGroup.com)

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 27 2003
Added on Nov 7 2003
7 comments
964 views