How do I insert/update records with some of the columns having NULL value?

Harikrishna Neerkaje

Use either of the following PreparedStatement methods:

public void setNull(int parameterIndex, int sqlType) throws SQLException

public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException

Joe Sam Shirah adds: Note that these methods assume that the columns are nullable. In this case, you can also just omit the columns in an INSERT statement; they will be automatically assigned null values.