From: | "Kapoor, Nishikant X" <Nishikant(dot)X(dot)Kapoor(at)nspco(dot)com> |
---|---|
To: | "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org> |
Cc: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | How to set java.sql.Date to null ? |
Date: | 1998-08-03 19:16:20 |
Message-ID: | C7DCBA49A357D11196A500805F851ACD0146163E@MNMAIL04 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-interfaces |
Hi there
I'm trying to pass a java.sql.Date parameter to a sql query using
JDBC-PostgreSQL interface. The problem shows up when I pass a null
java.sql.Date but as it happens in my application, the user may or may
not
enter the logDate.
(It works fine if the java.sql.Date(logDate) is a valid date).
Here is the code:
PreparedStatement pstmt = null;
try {
pstmt = connect.prepareStatement("insert into prfs (prfNo, author,
severity, blockFunc, probArea, status, probDesc, logDate, estCompDate,
actCompDate, assigned, assignee,
solution, attachment, siemensVar, reviewer) values " +
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" );
pstmt.setString(1, prfNo);
pstmt.setString(2, author);
pstmt.setInt(3, severity);
pstmt.setInt(4, blockFunc);
pstmt.setInt(5, probArea);
pstmt.setInt(6, status);
pstmt.setString(7, probDesc);
--> pstmt.setDate(8, logDate); <-- NullPointerException ex
} catch (SQLException e) { }
How do I set a Date to be a null ?
Thanks
Nishi
--------To err is human but to really mess it up is computer--------
mailto:nishikant(dot)x(dot)kapoor(at)nspco(dot)com http://www.c3ipros.com/nkapoor
-----------------------------------~~~------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Johnson | 1998-08-03 21:06:46 | Replication information |
Previous Message | John E. Garrott | 1998-08-03 19:12:13 | Re: [GENERAL] psql problem |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter T Mount | 1998-08-03 21:40:11 | Re: [INTERFACES] How to set java.sql.Date to null ? |
Previous Message | Hannu Krosing | 1998-08-03 15:03:36 | Re: [INTERFACES] creatng a new interface to postgresql, how do I update a field with a particular oid? |