Try using.
pst.setNull(4, java.sql.Types.INTEGER); //pst is prepared statement instance.
Interface PreparedStatement.setNull API
Mapping of java.sql.Types to SQL types
P.S. : Edited to reflect Java 8 updates.
More Related Contents:
- How to get the insert ID in JDBC?
- Insert & fetch java.time.LocalDate objects to/from an SQL database such as H2
- java.util.Date vs java.sql.Date
- Using setDate in PreparedStatement
- Efficient way to do batch INSERTS with JDBC
- How do I get the size of a java.sql.ResultSet?
- How can I get the SQL of a PreparedStatement?
- What is the best approach using JDBC for parameterizing an IN clause? [duplicate]
- Variable column names using prepared statements
- MySQL and JDBC with rewriteBatchedStatements=true
- right syntax to use near ‘?’
- Running a .sql script using MySQL with JDBC
- JDBC Pagination
- Getting output from dbms_output.get_lines using JDBC
- org.postgresql.util.PSQLException: FATAL: sorry, too many clients already
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbname [duplicate]
- Java – Can’t use ResultSet after connection close
- Timezones in SQL DATE vs java.sql.Date
- Queries returning multiple result sets
- SQL prepared statement how to select via multiple possible menu selections?
- Class.forName(JDBC_DRIVER) no longer needed?
- dll missing in JDBC
- How do I use PostgreSQL JSON(B) operators containing a question mark “?” via JDBC
- Java – Storing SQL statements in an external file [closed]
- How to use prepared statement for select query in Java?
- A datetime equivalent in java.sql ? (is there a java.sql.datetime ?)
- MS SQL Exception: Incorrect syntax near ‘@P0’
- Java JDBC connection status
- MyBatis executing multiple sql statements in one go, is that possible?
- Database independence through JDBC in java