PostgresSQL Connection Pool for Tomcat

Create postgres.jar

This jar contains the JDBC drivers for PostgreSQL. To use connection pooling, you must make sure you compiled it with java 1.3 or higher. You can check whether this has been done by listing the contents of the jar file.


bash-2.05a$ pwd
/usr/local/pgsql/share/java
bash-2.05a$ jar tvf postgresql.jar
     0 Tue May 18 19:21:14 EST 2004 META-INF/
   107 Tue May 18 19:21:12 EST 2004 META-INF/MANIFEST.MF
     0 Tue May 18 19:21:06 EST 2004 org/
     0 Tue May 18 19:21:10 EST 2004 org/postgresql/
   809 Tue May 18 19:21:06 EST 2004 org/postgresql/PGConnection.class
..
..
     0 Tue May 18 19:21:10 EST 2004 org/postgresql/jdbc2/optional/
  5610 Tue May 18 19:21:10 EST 2004 org/postgresql/jdbc2/optional/BaseDataSource.class
  2196 Tue May 18 19:21:10 EST 2004 org/postgresql/jdbc2/optional/ConnectionPool.class
  4195 Tue May 18 19:21:10 EST 2004 org/postgresql/jdbc2/optional/PGObjectFactory.class
  5107 Tue May 18 19:21:10 EST 2004 org/postgresql/jdbc2/optional/PooledConnectionImpl$ConnectionHandler.class
  3029 Tue May 18 19:21:10 EST 2004 org/postgresql/jdbc2/optional/PooledConnectionImpl$StatementHandler.class
..

The jdbc2/optional/ directory indicates that you can use Connection pooling, and if the jdbc3/ exists its also a good sign.

Add to tomcat lib

Add this to Tomcat's libary directory, or to your web applications lib directory.

Published: Tuesday, 18 May 2004