From: | Péter Kovács <peter(dot)dunay(dot)kovacs(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Inserting into time stamp columns |
Date: | 2013-06-26 14:39:28 |
Message-ID: | CAO01x1FkfZCDvSfDuMDyJ9dUGnfiV5oBjvVOC9EOwQ06cmxckg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi,
Consider the following simple table:
create table tstest (ts timestamp);
The following code snippet
PreparedStatement pstmt = connection.prepareStatement("insert into
tstest values(?)");
pstmt.setObject(1, "1998-06-04 00:00:00+09");
pstmt.execute();
results in the following error:
Exception in thread "main" org.postgresql.util.PSQLException: ERROR: column
"ts" is of type timestamp without time zone but expression is of type
character varying
Hint: You will need to rewrite or cast the expression.
Do I understand it correctly that it is a limitation of the JDBC
driver not to implement the String -> Timestamp implicit conversion
listed in Table 8.5 of this document:
http://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html#1034737
? Or is something missing in my code to get the friendly behavior of
plain SQL which works with time stamp strings such as '1998-06-04
00:00:00+09 without explicit conversion?
Many thanks
Peter
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2013-06-26 14:51:33 | Re: Inserting into time stamp columns |
Previous Message | Kevin Carr | 2013-06-26 13:46:42 | Re: JDBC 4 Compliance |