pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabios@logi-track.com>
To: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
To: PostGIS Development Discussion <postgis-devel@postgis.refractions.net>
To: alex bodnaru <alexbodn@012.net.il>
Subject: PGConnection vs. Connection
Date: Fri, 11 Feb 2005 16:46:46 +0100
Message-ID: <420CD366.8040603@logi-track.com> (raw)

[Crosspost to psql-jdbc, postgis-devel and alex bodnaru]

Dear pgjdbc developers,

When backporting toe PostGIS jdbc extension to debian woody (which still
uses pgjdbc 7.2), Alex Bodnaru (PostGIS debian packager) stumbled over
the fact that the addDataType() methods are carried by the
org.postgresql.Connection class instead of the
org.postgresql.PGConnection interface in 7.3 and up.

An additional minor problem is that addDataType(String) is deprecated in
8.0 and this gives compiler warnings (and has the known class loader
related problems). This problem is minor because the old method works as
good as ever, and pgjdbc 8.0 provides the autoregistration via
driverconfig.properties so we do not strictly need addDataType() calls
at all in _most_ environments.

We're currently wondering what the best method is for supporting 7.2,
the following have come to our mind.

- Prodiding a patch that is to be applied manually (rsp. by the debian
  package build process) when building for 7.2. (this is our "current
  practice").

- Using some kind of pgjdbc autorecognition and preprocessing (e. G. ant
  filters or C preprocessor). Because of the disadvantages regarding
  common Java IDEs (Syntax highlighting, error checking tools etc.) and
  the more complicated build process, I dislike the idea of introducing
  a separate preprocessing step in a Java project as small as PostGIS
  jdbc. But this is only my personal opinion, and you can convince me
  with appropriate arguments.

- Manage two different source trees.

- Using reflection. This could allow us per run-time distinction to use
  o.p.PGConnection.addDataType(Class) when running against pgjdbc 8.0,
  o.p.PGConnection.addDataType(String) against 7.3/7.4, and
  o.p.Connection.addDataType(String) against 7.2. This way we could ship
  a single postgis.jar that runs against all pgjdbc versions.

- Using our own copy of PGConnection and Connection sources during our
  build process. We could then use conn.getClass().getName() or such to
  distinct which code to call, and encapsulate the actual code in
  functor objects that get instantiated lazy, so we only load the
  class that actually fits the real connection implementation (this
  should avoid classloader trouble).

Which approach do you think to be the best one? Another question is
whether it is worth the effort to develop any complicated scheme, as
only a very few lines of code are actually affected.

Markus
-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios@logi-track.com | www.logi-track.com



view thread (3+ messages)  latest in thread

Message-ID: <420CD366.8040603@logi-track.com>
Permalink:  ../420CD366.8040603@logi-track.com/
Also on:    postgresql.org/message-id/420CD366.8040603@logi-track.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: schabios@logi-track.com, postgis-devel@postgis.refractions.net, alexbodn@012.net.il
  Subject: Re: PGConnection vs. Connection
  In-Reply-To: <420CD366.8040603@logi-track.com>
  References: <420CD366.8040603@logi-track.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox