Re: javax.sql.DataSource implementation - Mailing list pgsql-jdbc

From Scott Dunbar
Subject Re: javax.sql.DataSource implementation
Date
Msg-id 4A5A850A.7080505@xigole.com
Whole thread Raw
In response to javax.sql.DataSource implementation  (<diego.vera@capgemini-sdm.com>)
List 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.vera@capgemini-sdm.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

pgsql-jdbc by date:

Previous
From:
Date:
Subject: javax.sql.DataSource implementation
Next
From: "Campbell, Lance"
Date:
Subject: Java long