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
Cc: Ulrich Meis <kenobi@halifax.rwth-aachen.de>
Subject: Re: A solution to the SSL customizing problem
Date: Tue, 12 Oct 2004 12:33:02 +0200
Message-ID: <20041012123302.3ca76eb1@kingfisher.intern.logi-track.com> (raw)
In-Reply-To: <416B949E.5070502@opencloud.com>
References: <200410111752.33375.kenobi@halifax.rwth-aachen.de>
	<200410120620.04002.kenobi@halifax.rwth-aachen.de>
	<416B5EBC.6060507@opencloud.com>
	<200410120742.30677.kenobi@halifax.rwth-aachen.de>
	<416B949E.5070502@opencloud.com>

Hi, Oliver,

On Tue, 12 Oct 2004 21:23:58 +1300
Oliver Jowett <oliver@opencloud.com> wrote:

> The situation I am thinking of is when you are configuring a DataSource 
> for use in a managed environment, e.g. appserver. The appserver knows 
> nothing about the driver it is using beyond the standard JDBC interfaces 
> (and perhaps not even that, if it's using a JCA wrapper). This breaks as 
> soon as you have a magic method that needs to be called on the driver to 
> configure SSL properties. There is no way to teach the appserver how to 
> do this without hardwiring dependencies on the PG way of doing things.. 
> which does not make for a very portable appserver!

That's true.

We were very happy to learn that the JBoss connection pooling uses
wrappers that have a method to get the underlying original connection,
so we could call addDataType() to add the postGIS classes.

This left us with ugly code like:

    public static PGConnection unWrapPGConn(Connection conn) {
        PGConnection result = null;
        if (conn == null) {
            log.error("trying to unWrapPGConn(null)!");
            return null;
        }

        if (conn instanceof PGConnection) {
            result = (PGConnection) conn;
        } else if (conn instanceof WrappedConnection) {
            WrappedConnection w = (WrappedConnection) conn;
            try {
                result = unWrapPGConn(w.getUnderlyingConnection());
            } catch (SQLException e) {
                log.error("unWrapPGConn: Could not get underyling SQL connection!");
                log.error(e.toString());
            }
        }
        if (result == null) {
            log.warn("unWrapPGConn called with unknown connection type.");
            log.warn("given Connection Class is: " + conn.getClass().getPackage() + "." + conn.getClass().getName());
        }
        return result;
    }

So, you can see that this is a real world problem. Imagine we would need
to have our App portable to other app servers - this would not only
complicate the source above. We also would need to provide the appropriate
classes in the other environments, so the classloader can find them for
the instanceof call - this could imply strange licence issues.

Additionally, we currently have different apps with different needs
running in the same app server - so fine grained configurability is a
must. We cannot provide a single static method because the apps are
developed and deployed independently.

FIN,
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 (31+ messages)  latest in thread

Message-ID: <20041012123302.3ca76eb1@kingfisher.intern.logi-track.com>
Permalink:  ../20041012123302.3ca76eb1@kingfisher.intern.logi-track.com/
Also on:    postgresql.org/message-id/20041012123302.3ca76eb1@kingfisher.intern.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, kenobi@halifax.rwth-aachen.de
  Subject: Re: A solution to the SSL customizing problem
  In-Reply-To: <20041012123302.3ca76eb1@kingfisher.intern.logi-track.com>
  References: <200410111752.33375.kenobi@halifax.rwth-aachen.de> <200410120620.04002.kenobi@halifax.rwth-aachen.de> <416B5EBC.6060507@opencloud.com> <200410120742.30677.kenobi@halifax.rwth-aachen.de> <416B949E.5070502@opencloud.com> <20041012123302.3ca76eb1@kingfisher.intern.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