Re: problem with types in new jdbc driver

Поиск
Список
Период
Сортировка
От Roland Walter
Тема Re: problem with types in new jdbc driver
Дата
Msg-id 42B8130F.5000604@mosaic-ag.com
обсуждение исходный текст
Ответ на problem with types in new jdbc driver  (Jason Tesser <jtesser@nbbc.edu>)
Список pgsql-jdbc
Jason Tesser schrieb:

> I had posted this on the main postgres list and here is what Richard
> Huxton said.  I was wondering if one you you guys could shed some more
> light on this for me.  What has changed between the 7.4 driver and the
> 8.0 driver to cause this problem?
>

The JDBC driver 8.0 uses real prepared statements of the database
server. To do this the client-server protocol V3 is used, which needs to
know the real type of a parameter. So you must use setString only with
character values, setTimestamp with timestamp values, setLong with
BIGINT and so on.

The 7.4 JDBC driver did not use real prepared statements, it replaced
the parameters on the client side.

If you want to use setString with the 8.0 driver with timestamp values,
you have to write the cast into the statement string. To be more
compatible with other databases replace the setString with the
set-method that fits the type and convert the String to a
java.sql.Timestamp before.

--
Roland Walter
MOSAIC SOFTWARE AG
Telefon: 02225/882-411 Fax: 02225/882-201
http://www.mosaic-ag.com
-------  L E G A L    D I S C L A I M E R  ---------

Die Informationen in dieser Nachricht sind vertraulich
und ausschliesslich fuer den Adressaten bestimmt.
Kenntnisnahme durch Dritte ist unzulaessig. Die
Erstellung von Kopien oder das Weiterleiten an weitere,
nicht originaere und benannte Adressaten ist nicht
vorgesehen und kann ungesetzlich sein. Die Meinungen
in dieser Nachricht stellen lediglich die Meinungen
des Senders dar. Falls Sie vermuten, dass diese
Nachricht veraendert wurde, setzen Sie sich mit dem
Absender in Verbindung. Der Absender uebernimmt ohne
weitere Ueberpruefung keine Verantwortung fuer die
Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte
Empfaenger werden gebeten, die Vertraulichkeit der
Nachricht zu wahren und den Absender sofort ueber
einen Uebertragungsfehler zu informieren.
------------------------------------------------------


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

Предыдущее
От: Jason Tesser
Дата:
Сообщение: problem with types in new jdbc driver
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: problem with types in new jdbc driver