Thanks for the advice.
Because I'm using Apache Tomcat 6, I ended up using the built-in Jakarta
Commons DBCP to create a connection pool to Postgres. Not sure if this is a
best practice or not, but it appears to be working well.
For those interested in doing this on Tomcat, but don't know where to start,
my setup is below.
Thanks to those who provided the examples I found on the web and the text
"Professional Apache Tomcat 6" from Wrox.
I created a file "context.xml" in my web app's META-INF directory with the
From a java class you can access the connection pool by using the following
...and java code wrapped in a try/catch block...
String dsString = "java:/comp/env/jdbc/YourPool";
DataSource ds = (DataSource) new InitialContext().lookup(dsString);
Connection con = ds.getConnection();
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of John R Pierce
Sent: Tuesday, September 16, 2008 7:58 PM
Subject: Re: [JDBC] Best Practice to Create a Connection Pool in PostgreSQL
Greg James wrote:
> I've been looking through the mail archives in the JDBC forum and have
> seen a number of different ways to create a JDBC connection pool to
> Postgres. Could someone point me in the right direction, eg
> Jdbc3ConnectionPool, Apache's DBCP, etc.?
One reason there are so many ways is that there are different
requirements for connection pools.
In response to
pgsql-jdbc by date
|Next:||From: Guillaume Cottenceau||Date: 2008-09-17 08:29:28|
|Subject: Re: Informacion del JDBC|
|Previous:||From: John R Pierce||Date: 2008-09-17 01:57:37|
|Subject: Re: Best Practice to Create a Connection Pool in PostgreSQL|