java.sql.date insert as null - Mailing list pgsql-jdbc

From Mican Bican
Subject java.sql.date insert as null
Date
Msg-id 422CA65C.7050303@gmail.com
Whole thread Raw
Responses Re: java.sql.date insert as null  ("Prasanth" <dbadmin@nqadmin.com>)
Re: java.sql.date insert as null  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
Hello,

How can I store a java.sql.date as null in database. The problem is
(pseudecode):
....
java.sql.Date date = null;
....
Customer cust = new Customer(id);
cust.setSqlDate(date);

..insert into Customer (id..,date,...)
values(...
...." ' "+in.getSqlDate()+" ' ".....
...)

then the exception

java.sql.SQLException: ERROR: invalid input syntax for type date: "null"
........

when I select a row with empty date and system.out.print, it  gives me a
null.. but why I can't store it as null
I use jdbc3, postgresql 8.0.1 and java 5 (tiger) on windows

thank you

best regards Mican Bican





pgsql-jdbc by date:

Previous
From: Ian Pilcher
Date:
Subject: Re: ident auth postgres 7.4 fedora core 3
Next
From: Charl Gerber
Date:
Subject: postgre 7.3 / JSTL problem