Application Servers: ConnectionPoolDataSource

PostgreSQL™ includes one implementation of ConnectionPoolDataSource named org.postgresql.ds.PGConnectionPoolDataSource.

JDBC requires that a ConnectionPoolDataSource be configured via JavaBean properties, shown in Table 11.1, “ConnectionPoolDataSource Configuration Properties”, so there are get and set methods for each of these properties.

Table 11.1. ConnectionPoolDataSource Configuration Properties

PropertyTypeDescription
serverNameStringPostgreSQL™ database server host name
databaseNameStringPostgreSQL™ database name
portNumberint TCP port which the PostgreSQL™ database server is listening on (or 0 to use the default port)
userStringUser used to make database connections
passwordStringPassword used to make database connections
sslboolean If true, use SSL encrypted connections (default false)
sslfactoryString Custom javax.net.ssl.SSLSocketFactory class name (see the section called “Custom SSLSocketFactory”)
defaultAutoCommitboolean Whether connections should have autocommit enabled or disabled when they are supplied to the caller. The default is false, to disable autocommit.

Many application servers use a properties-style syntax to configure these properties, so it would not be unusual to enter properties as a block of text. If the application server provides a single area to enter all the properties, they might be listed like this:

serverName=localhost
databaseName=test
user=testuser
password=testpassword

Or, if semicolons are used as separators instead of newlines, it could look like this:

serverName=localhost;databaseName=test;user=testuser;password=testpassword