Mamta Satoor wrote:

Hi,

The JDBC API Tutorial and Reference book says that
"The method setObject (on PreparedStatement) can take a null value only if
the JDBC type is specified".
But I couldn't find anything similar for ResultSet.updateObject(int 
columnIndex, Object x).
Should this method throw an exception if null is passed for the Object since 
there is no
way to specify JDBC type for this particular signature of updateObject?

thanks,
Mamta



I suspect that a PreparedStatement may not always be able to decide on the type of a parameter when it compiles a statement, or it may not be able to do so easily. So PreparedStatement.setObject( i, null) may have trouble deciding how to handle the null. However a ResultSet knows the types of all of its columns, so ResultSet.updateObject( i, null) should treat the null as being of the type of the underlying column, which it knows.

Jack

Reply via email to