Re: javax.sql.DataSource implementation

From: Scott Dunbar <scott(at)xigole(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: javax.sql.DataSource implementation
Date: 2009-07-13 00:51:22
Message-ID: 4A5A850A.7080505@xigole.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Diego,
I think you're missing an important understanding regarding JDBC and a
DataSource. A DataSource is obtained from the container (for example,
Tomcat) that your application is running in. There are a few reasons to
do this. The most important is to separate the configuration of your
database connection from your source code. In pure JDBC you do all of
the connection configuration yourself - setting the user name, password,
driver, and so on. A DataSource, which is acquired through JNDI puts
all of the configuration of the database connection outside of your code
and makes it available to your application (or other applications or web
apps).

The downside of this is that each application server configures this
differently. WebLogic does it differently than Tomcat and they are both
different than WebSphere. Engines like JBoss and Glassfish muddy the
waters more. They embed Tomcat but have different ways of setting up
the JDNI DataSource.

I don't know what application server you're using but Tomcat has a great
page at
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
that includes a PostgreSQL specific section. If you're using a
different app server then you'll want to read the docs on how to get it
setup.

diego(dot)vera(at)capgemini-sdm(dot)com wrote:
>
> Hi all,
>
> I am using Jsecurity with postgresql and I require an implementation
> of the javax.sql.DataSource, I reviewed the source code of the jdbc
> driver and It seems that it is not implemented. Do you know where
> could I get it? Or should I implement my DataSource? I thouhg it
> should be part of the jdbc driver.
>
> Best regards,
>
> -Diego Vera
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Campbell, Lance 2009-07-13 19:04:56 Java long
Previous Message diego.vera 2009-07-12 22:00:45 javax.sql.DataSource implementation