@Deprecated public class PGPoolingDataSource extends BaseDataSource implements DataSource
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.5 and higher.
Modifier and Type | Field and Description |
---|---|
protected @Nullable String |
dataSourceName
Deprecated.
|
protected static ConcurrentMap<String,PGPoolingDataSource> |
dataSources
Deprecated.
|
Constructor and Description |
---|
PGPoolingDataSource()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDataSource(String dataSourceName)
Deprecated.
|
void |
close()
Deprecated.
Closes this DataSource, and all the pooled connections, whether in use or not.
|
protected PGConnectionPoolDataSource |
createConnectionPool()
Deprecated.
Creates the appropriate ConnectionPool to use for this DataSource.
|
Connection |
getConnection()
Deprecated.
Gets a connection from the connection pool.
|
Connection |
getConnection(@Nullable String user,
@Nullable String password)
Deprecated.
Gets a non-pooled connection, unless the user and password are the same as the default
values for this connection pool.
|
static @Nullable PGPoolingDataSource |
getDataSource(String name)
Deprecated.
|
@Nullable String |
getDataSourceName()
Deprecated.
Gets the name of this DataSource.
|
String |
getDescription()
Deprecated.
Gets a description of this DataSource.
|
int |
getInitialConnections()
Deprecated.
Gets the number of connections that will be created when this DataSource is initialized.
|
int |
getMaxConnections()
Deprecated.
Gets the maximum number of connections that the pool will allow.
|
Reference |
getReference()
Deprecated.
Adds custom properties for this DataSource to the properties defined in the superclass.
|
void |
initialize()
Deprecated.
Initializes this DataSource.
|
protected boolean |
isInitialized()
Deprecated.
|
boolean |
isWrapperFor(Class<?> iface)
Deprecated.
|
protected void |
removeStoredDataSource()
Deprecated.
|
void |
setDatabaseName(@Nullable String databaseName)
Deprecated.
Ensures the DataSource properties are not changed after the DataSource has been used.
|
void |
setDataSourceName(String dataSourceName)
Deprecated.
Sets the name of this DataSource.
|
void |
setInitialConnections(int initialConnections)
Deprecated.
Sets the number of connections that will be created when this DataSource is initialized.
|
void |
setMaxConnections(int maxConnections)
Deprecated.
Sets the maximum number of connections that the pool will allow.
|
void |
setPassword(@Nullable String password)
Deprecated.
Ensures the DataSource properties are not changed after the DataSource has been used.
|
void |
setPortNumber(int portNumber)
Deprecated.
Ensures the DataSource properties are not changed after the DataSource has been used.
|
void |
setServerName(String serverName)
Deprecated.
Ensures the DataSource properties are not changed after the DataSource has been used.
|
void |
setUser(@Nullable String user)
Deprecated.
Ensures the DataSource properties are not changed after the DataSource has been used.
|
<T> T |
unwrap(Class<T> iface)
Deprecated.
|
createReference, getAdaptiveFetch, getAdaptiveFetchMaximum, getAdaptiveFetchMinimum, getAllowEncodingChanges, getApplicationName, getAssumeMinServerVersion, getAutosave, getBinaryTransfer, getBinaryTransferDisable, getBinaryTransferEnable, getCancelSignalTimeout, getCleanupSavepoints, 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, getQuoteReturningIdentifiers, getReadOnly, getReadOnlyMode, getReceiveBufferSize, getRecvBufferSize, 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, setAdaptiveFetch, setAdaptiveFetchMaximum, setAdaptiveFetchMinimum, setAllowEncodingChanges, setApplicationName, setAssumeMinServerVersion, setAutosave, setBinaryTransfer, setBinaryTransferDisable, setBinaryTransferEnable, setCancelSignalTimeout, setCleanupSavepoints, setCleanupSavePoints, setConnectTimeout, setCurrentSchema, setDatabaseMetadataCacheFields, setDatabaseMetadataCacheFieldsMiB, setDefaultRowFetchSize, setDisableColumnSanitiser, setEscapeSyntaxCallMode, setFromReference, setGssEncMode, setGssLib, setHideUnprivilegedObjects, setHostRecheckSeconds, setJaasApplicationName, setJaasLogin, setKerberosServerName, setLoadBalanceHosts, setLoggerFile, setLoggerLevel, setLoginTimeout, setLogServerErrorDetail, setLogUnclosedConnections, setLogWriter, setMaxResultBuffer, setOptions, setPortNumbers, setPreferQueryMode, setPreparedStatementCacheQueries, setPreparedStatementCacheSizeMiB, setPrepareThreshold, setProperty, setProperty, setProtocolVersion, setQuoteReturningIdentifiers, setReadOnly, setReadOnlyMode, setReceiveBufferSize, setRecvBufferSize, setReplication, setReWriteBatchedInserts, setSendBufferSize, 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, setUseSpNego, setXmlFactoryFactory, writeBaseObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWriter
protected static ConcurrentMap<String,PGPoolingDataSource> dataSources
protected @Nullable String dataSourceName
public static @Nullable PGPoolingDataSource getDataSource(String name)
public String getDescription()
getDescription
in class BaseDataSource
public void setServerName(String serverName)
setServerName
in class BaseDataSource
serverName
- name of the host the PostgreSQL database is running onIllegalStateException
- The Server Name cannot be changed after the DataSource has been
used.public void setDatabaseName(@Nullable String databaseName)
setDatabaseName
in class BaseDataSource
databaseName
- name of the PostgreSQL databaseIllegalStateException
- The Database Name cannot be changed after the DataSource has been
used.public void setUser(@Nullable String user)
setUser
in class BaseDataSource
user
- user to connect as by defaultIllegalStateException
- The User cannot be changed after the DataSource has been used.public void setPassword(@Nullable String password)
setPassword
in class BaseDataSource
password
- password to connect with by defaultIllegalStateException
- The Password cannot be changed after the DataSource has been
used.public void setPortNumber(int portNumber)
setPortNumber
in class BaseDataSource
portNumber
- port which the PostgreSQL server is listening on for TCP/IPIllegalStateException
- The Port Number cannot be changed after the DataSource has been
used.public int getInitialConnections()
public void setInitialConnections(int initialConnections)
initialConnections
- number of initial connectionsIllegalStateException
- The Initial Connections cannot be changed after the DataSource
has been used.public int getMaxConnections()
public void setMaxConnections(int maxConnections)
maxConnections
- The maximum number of pooled connection to allow, or 0 for no maximum.IllegalStateException
- The Maximum Connections cannot be changed after the DataSource
has been used.public @Nullable String getDataSourceName()
public void setDataSourceName(String dataSourceName)
dataSourceName
- datasource nameIllegalStateException
- The Data Source Name cannot be changed after the DataSource has
been used.IllegalArgumentException
- Another PoolingDataSource with the same dataSourceName already
exists.public void initialize() throws SQLException
SQLException
- Occurs when the initialConnections is greater than zero, but the
DataSource is not able to create enough physical connections.protected boolean isInitialized()
protected PGConnectionPoolDataSource createConnectionPool()
public Connection getConnection(@Nullable String user, @Nullable String password) throws SQLException
getConnection
in interface DataSource
getConnection
in class BaseDataSource
user
- userpassword
- passwordSQLException
- Occurs when no pooled connection is available, and a new physical
connection cannot be created.public Connection getConnection() throws SQLException
getConnection
in interface DataSource
getConnection
in class BaseDataSource
SQLException
- Occurs when no pooled connection is available, and a new physical
connection cannot be created.public void close()
protected void removeStoredDataSource()
protected void addDataSource(String dataSourceName)
public Reference getReference() throws NamingException
getReference
in interface Referenceable
getReference
in class BaseDataSource
NamingException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
Copyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.