org.postgresql.ds
Class PGConnectionPoolDataSource

java.lang.Object
  extended by org.postgresql.ds.common.BaseDataSource
      extended by org.postgresql.ds.PGConnectionPoolDataSource
All Implemented Interfaces:
Serializable, Referenceable, CommonDataSource, ConnectionPoolDataSource
Direct Known Subclasses:
ConnectionPool, Jdbc3ConnectionPool

public class PGConnectionPoolDataSource
extends BaseDataSource
implements ConnectionPoolDataSource, Serializable

PostgreSQL implementation of ConnectionPoolDataSource. The app server or middleware vendor should provide a DataSource implementation that takes advantage of this ConnectionPoolDataSource. If not, you can use the PostgreSQL implementation known as PoolingDataSource, but that should only be used if your server or middleware vendor does not provide their own. Why? The server may want to reuse the same Connection across all EJBs requesting a Connection within the same Transaction, or provide other similar advanced features.

In any case, in order to use this ConnectionPoolDataSource, you must set the property databaseName. The settings for serverName, portNumber, user, and password are optional. Note: these properties are declared in the superclass.

This implementation supports JDK 1.3 and higher.

Author:
Aaron Mulder ([email protected])
See Also:
Serialized Form

Constructor Summary
PGConnectionPoolDataSource()
           
 
Method Summary
 String getDescription()
          Gets a description of this DataSource.
 Logger getParentLogger()
           
 PooledConnection getPooledConnection()
          Gets a connection which may be pooled by the app server or middleware implementation of DataSource.
 PooledConnection getPooledConnection(String user, String password)
          Gets a connection which may be pooled by the app server or middleware implementation of DataSource.
 boolean isDefaultAutoCommit()
          Gets whether connections supplied by this pool will have autoCommit turned on by default.
 void setDefaultAutoCommit(boolean defaultAutoCommit)
          Sets whether connections supplied by this pool will have autoCommit turned on by default.
 
Methods inherited from class org.postgresql.ds.common.BaseDataSource
createReference, getAllowEncodingChanges, getApplicationName, getAssumeMinServerVersion, getBinaryTransfer, getBinaryTransferDisable, getBinaryTransferEnable, getCancelSignalTimeout, getCharset, getCompatible, getConnection, getConnection, getConnectTimeout, getCurrentSchema, getDatabaseMetadataCacheFields, getDatabaseMetadataCacheFieldsMiB, getDatabaseName, getDefaultRowFetchSize, getDisableColumnSanitiser, getGssLib, getHostRecheckSeconds, getJaasApplicationName, getKerberosServerName, getLoadBalanceHosts, getLoginTimeout, getLoglevel, getLogLevel, getLogUnclosedConnections, getLogWriter, getPassword, getPortNumber, getPreparedStatementCacheQueries, getPreparedStatementCacheSizeMiB, getPrepareThreshold, getProperty, getProperty, getProtocolVersion, getReadOnly, getReceiveBufferSize, getReference, getReWriteBatchedInserts, getSendBufferSize, getServerName, getSocketFactory, getSocketFactoryArg, 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, setCancelSignalTimeout, setCharset, setCompatible, setConnectTimeout, setCurrentSchema, setDatabaseMetadataCacheFields, setDatabaseMetadataCacheFieldsMiB, setDatabaseName, setDefaultRowFetchSize, setDisableColumnSanitiser, setFromReference, setGssLib, setHostRecheckSeconds, setJaasApplicationName, setKerberosServerName, setLoadBalanceHosts, setLoginTimeout, setLoglevel, setLogLevel, setLogUnclosedConnections, setLogWriter, setPassword, setPortNumber, setPreparedStatementCacheQueries, setPreparedStatementCacheSizeMiB, setPrepareThreshold, setProperty, setProperty, setProtocolVersion, setReadOnly, setReceiveBufferSize, setReWriteBatchedInserts, setSendBufferSize, setServerName, setSocketFactory, setSocketFactoryArg, setSocketTimeout, setSsl, setSslCert, setSslfactory, setSslFactoryArg, setSslHostnameVerifier, setSslKey, setSslMode, setSslPassword, setSslPasswordCallback, setSslRootCert, setSspiServiceClass, setStringType, setTargetServerType, setTcpKeepAlive, setUnknownLength, setUrl, setUser, 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.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 

Constructor Detail

PGConnectionPoolDataSource

public PGConnectionPoolDataSource()
Method Detail

getDescription

public String getDescription()
Gets a description of this DataSource.

Specified by:
getDescription in class BaseDataSource
Returns:
description of this DataSource-ish thing

getPooledConnection

public PooledConnection getPooledConnection()
                                     throws SQLException
Gets a connection which may be pooled by the app server or middleware implementation of DataSource.

Specified by:
getPooledConnection in interface ConnectionPoolDataSource
Throws:
SQLException - Occurs when the physical database connection cannot be established.

getPooledConnection

public PooledConnection getPooledConnection(String user,
                                            String password)
                                     throws SQLException
Gets a connection which may be pooled by the app server or middleware implementation of DataSource.

Specified by:
getPooledConnection in interface ConnectionPoolDataSource
Throws:
SQLException - Occurs when the physical database connection cannot be established.

isDefaultAutoCommit

public boolean isDefaultAutoCommit()
Gets whether connections supplied by this pool will have autoCommit turned on by default. The default value is false, so that autoCommit will be turned off by default.

Returns:
true if connections supplied by this pool will have autoCommit

setDefaultAutoCommit

public void setDefaultAutoCommit(boolean defaultAutoCommit)
Sets whether connections supplied by this pool will have autoCommit turned on by default. The default value is false, so that autoCommit will be turned off by default.

Parameters:
defaultAutoCommit - whether connections supplied by this pool will have autoCommit

getParentLogger

public Logger getParentLogger()
                       throws SQLFeatureNotSupportedException
Throws:
SQLFeatureNotSupportedException


Copyright © 2016 PostgreSQL Global Development Group. All rights reserved.