| From: | pgsql-bugs(at)postgresql(dot)org |
|---|---|
| To: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | JDBC: allow update of Date-Columns with NULL |
| Date: | 2000-08-29 08:44:10 |
| Message-ID: | 200008290844.e7T8iA205143@hub.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Klaus Thiele (kth(at)pi-ag(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.
Short Description
JDBC: allow update of Date-Columns with NULL
Long Description
JDBC: updating of Date (and other not_String)-columns with an null value throws an exception!
(this works with other jdbc-drivers (oracle, informix,...)
Sample Code
String updateStatement = "update table set datefield = ?";
prepStmt = con.prepareStatement(updateStatement);
prepStmt.setDate(1, datefield); // datefield is null!!
prepStmt.executeUpdate();
==> "Exception: No value specified for parameter 1"
Solution:
add following code to "PreparedStatement.java":
in method "setDate()" (and others):
// if the passed value is null, then set this column to null
if(x==null)
set(parameterIndex,"null");
else {
[...]
No file was uploaded with this report
| From | Date | Subject | |
|---|---|---|---|
| Next Message | The Hermit Hacker | 2000-08-29 12:05:25 | Re: [GENERAL] cannot vacuum a database ! |
| Previous Message | Ange Michel POZZO | 2000-08-29 08:23:55 | cannot vacuum a database ! |