NULL values and Java JDBC

Started by Matthias Apitzover 3 years ago3 messagesgeneral
Jump to latest
#1Matthias Apitz
guru@unixarea.de

Hello,

Columns may contain NULL values. The ecpg for pre-compiling ESQL/C code
has an option to let return NULL values in CHAR columns as empty strings ""
and INTEGER as INT_MIN (-0x7fffffff - 1) values. Is there a similar
option for Java JDBC?

Thanks

matthias

--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

#2Rob Sargent
robjsargent@gmail.com
In reply to: Matthias Apitz (#1)
Re: NULL values and Java JDBC

On 9/30/22 09:46, Matthias Apitz wrote:

Hello,

Columns may contain NULL values. The ecpg for pre-compiling ESQL/C code
has an option to let return NULL values in CHAR columns as empty strings ""
and INTEGER as INT_MIN (-0x7fffffff - 1) values. Is there a similar
option for Java JDBC?

Thanks

matthias

Have you looked at java.sql.PreparedStatement.setNull() or .setObject() etc?

#3Matthias Apitz
guru@unixarea.de
In reply to: Rob Sargent (#2)
Re: NULL values and Java JDBC

El día viernes, septiembre 30, 2022 a las 09:56:07a. m. -0600, Rob Sargent escribió:

On 9/30/22 09:46, Matthias Apitz wrote:

Hello,

Columns may contain NULL values. The ecpg for pre-compiling ESQL/C code
has an option to let return NULL values in CHAR columns as empty strings ""
and INTEGER as INT_MIN (-0x7fffffff - 1) values. Is there a similar
option for Java JDBC?

Have you looked at java.sql.PreparedStatement.setNull() or .setObject() etc?

I was thinking more in a general setting of such feature (like ecpg does
it for ESQL/C) and not addressing such problem on any single statement
or object.

matthias

--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub