Re: Inserting an Interval Using JDBC

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Inserting an Interval Using JDBC
Дата
Msg-id 43D53825.10107@opencloud.com
обсуждение исходный текст
Ответ на Inserting an Interval Using JDBC  (Will Szopko <dba@vilaj.com>)
Ответы Re: Inserting an Interval Using JDBC  (Will Szopko <dba@vilaj.com>)
Список pgsql-jdbc
Will Szopko wrote:

> I have just upgraded to the 8.1-404 version of the JDBC driver from a
> much older version. In the past I had been able load an interval into my
> database by sending it as a string, as such:
>
> String myInterval = "08:00";  // 8 hour interval
> ...
> stmt.setString(1, myInterval);
>
> Using the new driver I am no longer able to do this and get the
> following error:
>
> column "num_hours" is of type interval but expression is of type text

Use "CAST (? AS INTERVAL)" in your query, or use the custom
org.postgresql.util.PGInterval type and pass an instance to setObject().

-O

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "balpo (sent by Nabble.com)"
Дата:
Сообщение: Re: RFP: Finish JDBC driver
Следующее
От: Will Szopko
Дата:
Сообщение: Re: Inserting an Interval Using JDBC