Inserting into time stamp columns
От | Péter Kovács |
---|---|
Тема | Inserting into time stamp columns |
Дата | |
Msg-id | CAO01x1FkfZCDvSfDuMDyJ9dUGnfiV5oBjvVOC9EOwQ06cmxckg@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Inserting into time stamp columns
|
Список | 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
В списке pgsql-jdbc по дате отправления: