Re: Prepared Statements - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Prepared Statements
Date
Msg-id 20030721000241.GB665@opencloud.com
Whole thread Raw
In response to Re: Prepared Statements  (Dima Tkach <dmitry@openratings.com>)
Responses Re: Prepared Statements  (Dima Tkach <dmitry@openratings.com>)
Re: Prepared Statements  (Dmitry Tkach <dmitry@openratings.com>)
List pgsql-jdbc
On Sun, Jul 20, 2003 at 12:39:45PM -0400, Dima Tkach wrote:
> The problem with this (and other similar suggestions in this thread -
> like use PGArray etc.) is that the app will not even compile with
> postgres jdbc classes.
> The whole point in using jdbc interfaces is to abstract the application
> from the particular driver implementation.

My current approach is what Fernando suggested -- use setArray() and look
for a preceeding IN. This can work without needing any postgres specific
classes -- I'll add a simple implementation of java.sql.Array that wraps a
Java array to the driver source, but if you don't want to be dependent on
the driver you can provide your own implementation.

The interface-abstraction argument only really works up to the point where
you want to do something not defined in the interface. Usually when I'm
doing DB-specific extension stuff I have a per-DB subclass that does the
special bits; if you don't have the driver available, you don't compile that
subclass. So I don't really buy the "can't build" argument. The same
thing applies to extensions like setUseServerPrepare(), BTW.

-O

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: jdbc batch performance problem
Next
From: Oliver Jowett
Date:
Subject: Re: getArray() fails to handle some string array cases