Kbase 20829: JDBC java.lang.NullPointerException if Updating ResultSet
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/15/2008 |
|
Status: Verified
FACT(s) (Environment):
Progress 9.1x
SYMPTOM(s):
java.lang.NullPointerException error when updating ResultSet returned with JDBC SQL-92 Driver
ResultSet method used:
updateString(int columnIndex, String x)
updateString(String columnName, String x)
updateRow()
etc.
java.lang.NullPointerException:
at
com.progress.sql.jdbc.JdbcProgressBoundCol.setRowValues
(JdbcProgressBoundCol.java:243)
CAUSE:
The ResultSet that is returned is in read-only mode, and any attempt to update rows of the ResultSet causes the error. The top of the stack trace that is returned if attempting to update with the Progress 9.1B JDBC driver looks like the following:
java.lang.NullPointerException:
at
com.progress.sql.jdbc.JdbcProgressBoundCol.setRowValues
(JdbcProgressBoundCol.java:243)
One possible method to check the mode of the ResultSet is with:
getConcurrency()
FIX:
The ResultSet must be set to allow updates before attempting to update the rows. This can be accomplished when creating the statement. For example:
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
In this example, con is a java.sql.Connection