Re: problem with types in new jdbc driver

From: Roland Walter <rwa(at)mosaic-ag(dot)com>
To: Jason Tesser <jtesser(at)nbbc(dot)edu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: problem with types in new jdbc driver
Date: 2005-06-21 13:15:59
Message-ID: 42B8130F.5000604@mosaic-ag.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.
------------------------------------------------------

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2005-06-21 13:21:15 Re: problem with types in new jdbc driver
Previous Message Jason Tesser 2005-06-21 12:54:10 problem with types in new jdbc driver