pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mican Bican <mican58@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: java.sql.date insert as null
Date: Mon, 07 Mar 2005 20:07:08 +0100
Message-ID: <422CA65C.7050303@gmail.com> (raw)

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







view thread (3+ messages)  latest in thread

Message-ID: <422CA65C.7050303@gmail.com>
Permalink:  ../422CA65C.7050303@gmail.com/
Also on:    postgresql.org/message-id/422CA65C.7050303@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: mican58@gmail.com
  Subject: Re: java.sql.date insert as null
  In-Reply-To: <422CA65C.7050303@gmail.com>
  References: <422CA65C.7050303@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox