java.sql.date insert as null

From: Mican Bican <mican58(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: java.sql.date insert as null
Date: 2005-03-07 19:07:08
Message-ID: 422CA65C.7050303@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Charl Gerber 2005-03-07 19:07:44 postgre 7.3 / JSTL problem
Previous Message Ian Pilcher 2005-03-07 17:56:37 Re: ident auth postgres 7.4 fedora core 3