org.postgresql.ds
Class PGPoolingDataSource

java.lang.Object
  extended by org.postgresql.ds.common.BaseDataSource
      extended by org.postgresql.ds.jdbc23.AbstractJdbc23PoolingDataSource
          extended by org.postgresql.ds.jdbc4.AbstractJdbc4PoolingDataSource
              extended by org.postgresql.ds.PGPoolingDataSource
All Implemented Interfaces:
java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.DataSource

public class PGPoolingDataSource
extends org.postgresql.ds.jdbc4.AbstractJdbc4PoolingDataSource
implements javax.sql.DataSource

DataSource which uses connection pooling. Don't use this if your server/middleware vendor provides a connection pooling implementation which interfaces with the PostgreSQL ConnectionPoolDataSource implementation! This class is provided as a convenience, but the JDBC Driver is really not supposed to handle the connection pooling algorithm. Instead, the server or middleware product is supposed to handle the mechanics of connection pooling, and use the PostgreSQL implementation of ConnectionPoolDataSource to provide the connections to pool.

If you're sure you want to use this, then you must set the properties dataSourceName, databaseName, user, and password (if required for the user). The settings for serverName, portNumber, initialConnections, and maxConnections are optional. Note that only connections for the default user will be pooled! Connections for other users will be normal non-pooled connections, and will not count against the maximum pool size limit.

If you put this DataSource in JNDI, and access it from different JVMs (or otherwise load this class from different ClassLoaders), you'll end up with one pool per ClassLoader or VM. This is another area where a server-specific implementation may provide advanced features, such as using a single pool across all VMs in a cluster.

This implementation supports JDK 1.3 and higher.

Author:
Aaron Mulder ([email protected])

Field Summary
 
Fields inherited from class org.postgresql.ds.jdbc23.AbstractJdbc23PoolingDataSource
dataSourceName, dataSources
 
Constructor Summary
PGPoolingDataSource()
           
 
Method Summary
protected  void addDataSource(java.lang.String dataSourceName)
           
 
Methods inherited from class org.postgresql.ds.jdbc4.AbstractJdbc4PoolingDataSource
getParentLogger, isWrapperFor, unwrap
 
Methods inherited from class org.postgresql.ds.jdbc23.AbstractJdbc23PoolingDataSource
close, createConnectionPool, getConnection, getConnection, getDataSource, getDataSourceName, getDescription, getInitialConnections, getMaxConnections, getReference, initialize, isInitialized, removeStoredDataSource, setDatabaseName, setDataSourceName, setInitialConnections, setMaxConnections, setPassword, setPortNumber, setServerName, setUser
 
Methods inherited from class org.postgresql.ds.common.BaseDataSource
createReference, getAllowEncodingChanges, getApplicationName, getAssumeMinServerVersion, getBinaryTransfer, getBinaryTransferDisable, getBinaryTransferEnable, getCharset, getCompatible, getConnectTimeout, getCurrentSchema, getDatabaseName, getDisableColumnSanitiser, getGssLib, getHostRecheckSeconds, getJaasApplicationName, getKerberosServerName, getLoadBalanceHosts, getLoginTimeout, getLogLevel, getLogUnclosedConnections, getLogWriter, getPassword, getPortNumber, getPrepareThreshold, getProperty, getProperty, getProtocolVersion, getReadOnly, getReceiveBufferSize, getSendBufferSize, getServerName, getSocketTimeout, getSsl, getSslCert, getSslfactory, getSslFactoryArg, getSslHostnameVerifier, getSslKey, getSslMode, getSslPassword, getSslPasswordCallback, getSslRootCert, getSspiServiceClass, getStringType, getTargetServerType, getTcpKeepAlive, getUnknownLength, getUrl, getUser, getUseSpNego, initializeFrom, isColumnSanitiserDisabled, readBaseObject, setAllowEncodingChanges, setApplicationName, setAssumeMinServerVersion, setBinaryTransfer, setBinaryTransferDisable, setBinaryTransferEnable, setCharset, setCompatible, setConnectTimeout, setCurrentSchema, setDisableColumnSanitiser, setFromReference, setGssLib, setHostRecheckSeconds, setJaasApplicationName, setKerberosServerName, setLoadBalanceHosts, setLoginTimeout, setLogLevel, setLogUnclosedConnections, setLogWriter, setPrepareThreshold, setProperty, setProperty, setProtocolVersion, setReadOnly, setReceiveBufferSize, setSendBufferSize, setSocketTimeout, setSsl, setSslCert, setSslfactory, setSslFactoryArg, setSslHostnameVerifier, setSslKey, setSslMode, setSslPassword, setSslPasswordCallback, setSslRootCert, setSspiServiceClass, setStringType, setTargetServerType, setTcpKeepAlive, setUnknownLength, setUrl, setUseSpNego, writeBaseObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sql.DataSource
getConnection, getConnection
 
Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Constructor Detail

PGPoolingDataSource

public PGPoolingDataSource()
Method Detail

addDataSource

protected void addDataSource(java.lang.String dataSourceName)
Specified by:
addDataSource in class org.postgresql.ds.jdbc23.AbstractJdbc23PoolingDataSource