Tuesday, December 29, 2009

UpdateRow results error " Result set is not updatable " Or "The cursor is READ ONLY" JDBC Java sql server 2000 , sql server 2005 database connectio

The cursor is READ ONLY OR Result set is not updatable in JDBC


When running a JAVA application which uses Microsoft sql server 2005 database connectivity and trying update a table Microsoft Sql Server 2000 database. When using updaterow method to update the resultset you will receive the following error message.

If you are using Sql Server 2005 database driver version 1.1 the error message will be

com.microsoft.sqlserver.jdbc.SQLServerException: Result set is not updatable.

If you are using Sql Server 2005 database driver version 1.1 the error message will be

com.microsoft.sqlserver.jdbc.SQLServerException: The cursor is READ ONLY.

The reason for this error is the implicit cursor conversion happening in sql server 2000. The implicit conversion is happening if the query returns a result set or the the table have no primary key or unique key including the column which you re using for order by.



To avoid this error change the query or set primary key for the table.

Another way is after selecting fetch each record in resultset and manually update



REGARDS

No comments:

Post a Comment