Resultset getint null java
java2s. com Email: info at java2s. com Demo Source and Support. All rights reserved.A ResultSet provides method getInt() that returns primitive int. Is it possible to obtain the Integer object, which permits null? The DB field I'm retrieving is nullable and getInt() returns me 0 whenever the field is null resultset getint null java
All this problem stems from the fact that the column field is NULL allowed in the database. And sorry guys for telling you that its a NPE while in fact its SQLException(noob here). If the column is null, the ResultSet should return null. normally, you can call the wasNull() method.
Java ResultSet. getInt(int columnIndex) Syntax. ResultSet. getInt(int columnIndex) has the following syntax. Apr 09, 2002 Hi, How do I check for NULL value returned from the ResultSet statement? thanks.resultset getint null java No, ResultSet returned by method can never be null. Moreover, the standard way to check whether a ResultSet is empty or not is to try setting its cursor to first row by using its first() and if it returns false it indicates that ResultSet is empty.