Package org.postgresql.ds
Class PGConnectionPoolDataSource
- java.lang.Object
-
- org.postgresql.ds.common.BaseDataSource
-
- org.postgresql.ds.PGConnectionPoolDataSource
-
- All Implemented Interfaces:
java.io.Serializable
,javax.naming.Referenceable
,javax.sql.CommonDataSource
,javax.sql.ConnectionPoolDataSource
- Direct Known Subclasses:
ConnectionPool
,Jdbc3ConnectionPool
public class PGConnectionPoolDataSource extends BaseDataSource implements javax.sql.ConnectionPoolDataSource, java.io.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 (ammulder@chariotsolutions.com)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PGConnectionPoolDataSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDescription()
Gets a description of this DataSource.javax.sql.PooledConnection
getPooledConnection()
Gets a connection which may be pooled by the app server or middleware implementation of DataSource.javax.sql.PooledConnection
getPooledConnection(java.lang.String user, java.lang.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, getAutosave, getBinaryTransfer, getBinaryTransferDisable, getBinaryTransferEnable, getCancelSignalTimeout, getCleanupSavepoints, getConnection, getConnection, getConnectTimeout, getCurrentSchema, getDatabaseMetadataCacheFields, getDatabaseMetadataCacheFieldsMiB, getDatabaseName, getDefaultRowFetchSize, getDisableColumnSanitiser, getEscapeSyntaxCallMode, getGssEncMode, getGssLib, getHideUnprivilegedObjects, getHostRecheckSeconds, getJaasApplicationName, getJaasLogin, getKerberosServerName, getLoadBalanceHosts, getLoggerFile, getLoggerLevel, getLoginTimeout, getLogServerErrorDetail, getLogUnclosedConnections, getLogWriter, getMaxResultBuffer, getOptions, getParentLogger, getPassword, getPortNumber, getPortNumbers, getPreferQueryMode, getPreparedStatementCacheQueries, getPreparedStatementCacheSizeMiB, getPrepareThreshold, getProperty, getProperty, getProtocolVersion, getReadOnly, getReadOnlyMode, getReceiveBufferSize, getRecvBufferSize, getReference, getReplication, getReWriteBatchedInserts, getSendBufferSize, getServerName, getServerNames, getSocketFactory, getSocketFactoryArg, getSocketTimeout, getSsl, getSslcert, getSslCert, getSslfactory, getSslfactoryarg, getSslFactoryArg, getSslhostnameverifier, getSslHostnameVerifier, getSslkey, getSslKey, getSslmode, getSslMode, getSslpassword, getSslPassword, getSslpasswordcallback, getSslPasswordCallback, getSslrootcert, getSslRootCert, getSspiServiceClass, getStringType, getTargetServerType, getTcpKeepAlive, getUnknownLength, getUrl, getURL, getUser, getUseSpNego, getXmlFactoryFactory, initializeFrom, isAllowEncodingChanges, isCleanupSavePoints, isColumnSanitiserDisabled, isDisableColumnSanitiser, isLoadBalanceHosts, isLogUnclosedConnections, isReadOnly, isReWriteBatchedInserts, isSsl, isTcpKeepAlive, readBaseObject, setAllowEncodingChanges, setApplicationName, setAssumeMinServerVersion, setAutosave, setBinaryTransfer, setBinaryTransferDisable, setBinaryTransferEnable, setCancelSignalTimeout, setCleanupSavepoints, setCleanupSavePoints, setConnectTimeout, setCurrentSchema, setDatabaseMetadataCacheFields, setDatabaseMetadataCacheFieldsMiB, setDatabaseName, setDefaultRowFetchSize, setDisableColumnSanitiser, setEscapeSyntaxCallMode, setFromReference, setGssEncMode, setGssLib, setHideUnprivilegedObjects, setHostRecheckSeconds, setJaasApplicationName, setJaasLogin, setKerberosServerName, setLoadBalanceHosts, setLoggerFile, setLoggerLevel, setLoginTimeout, setLogServerErrorDetail, setLogUnclosedConnections, setLogWriter, setMaxResultBuffer, setOptions, setPassword, setPortNumber, setPortNumbers, setPreferQueryMode, setPreparedStatementCacheQueries, setPreparedStatementCacheSizeMiB, setPrepareThreshold, setProperty, setProperty, setProtocolVersion, setReadOnly, setReadOnlyMode, setReceiveBufferSize, setRecvBufferSize, setReplication, setReWriteBatchedInserts, setSendBufferSize, setServerName, setServerNames, setSocketFactory, setSocketFactoryArg, setSocketTimeout, setSsl, setSslcert, setSslCert, setSslfactory, setSslfactoryarg, setSslFactoryArg, setSslhostnameverifier, setSslHostnameVerifier, setSslkey, setSslKey, setSslmode, setSslMode, setSslpassword, setSslPassword, setSslpasswordcallback, setSslPasswordCallback, setSslrootcert, setSslRootCert, setSspiServiceClass, setStringType, setTargetServerType, setTcpKeepAlive, setUnknownLength, setUrl, setURL, setUser, setUseSpNego, setXmlFactoryFactory, writeBaseObject
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
getDescription
public java.lang.String getDescription()
Gets a description of this DataSource.- Specified by:
getDescription
in classBaseDataSource
- Returns:
- description of this DataSource-ish thing
-
getPooledConnection
public javax.sql.PooledConnection getPooledConnection() throws java.sql.SQLException
Gets a connection which may be pooled by the app server or middleware implementation of DataSource.- Specified by:
getPooledConnection
in interfacejavax.sql.ConnectionPoolDataSource
- Throws:
java.sql.SQLException
- Occurs when the physical database connection cannot be established.
-
getPooledConnection
public javax.sql.PooledConnection getPooledConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
Gets a connection which may be pooled by the app server or middleware implementation of DataSource.- Specified by:
getPooledConnection
in interfacejavax.sql.ConnectionPoolDataSource
- Throws:
java.sql.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 istrue
, so that autoCommit will be turned on 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 istrue
, so that autoCommit will be turned on by default.- Parameters:
defaultAutoCommit
- whether connections supplied by this pool will have autoCommit
-
-