public abstract class BaseDataSource extends Object implements CommonDataSource, Referenceable
| Constructor and Description |
|---|
BaseDataSource() |
| Modifier and Type | Method and Description |
|---|---|
protected Reference |
createReference()
Generates a reference using the appropriate object factory.
|
boolean |
getAllowEncodingChanges() |
String |
getApplicationName() |
String |
getAssumeMinServerVersion() |
AutoSave |
getAutosave() |
boolean |
getBinaryTransfer() |
String |
getBinaryTransferDisable() |
String |
getBinaryTransferEnable() |
int |
getCancelSignalTimeout() |
Connection |
getConnection()
Gets a connection to the PostgreSQL database.
|
Connection |
getConnection(String user,
String password)
Gets a connection to the PostgreSQL database.
|
int |
getConnectTimeout() |
String |
getCurrentSchema() |
int |
getDatabaseMetadataCacheFields() |
int |
getDatabaseMetadataCacheFieldsMiB() |
String |
getDatabaseName()
Gets the name of the PostgreSQL database, running on the server identified by the serverName
property.
|
int |
getDefaultRowFetchSize() |
abstract String |
getDescription()
Gets a description of this DataSource-ish thing.
|
boolean |
getDisableColumnSanitiser() |
String |
getGssLib() |
int |
getHostRecheckSeconds() |
String |
getJaasApplicationName() |
boolean |
getJaasLogin() |
String |
getKerberosServerName() |
boolean |
getLoadBalanceHosts() |
String |
getLoggerFile() |
String |
getLoggerLevel() |
int |
getLoginTimeout()
Gets the maximum time in seconds that this data source can wait
while attempting to connect to a database.
|
boolean |
getLogUnclosedConnections() |
PrintWriter |
getLogWriter()
This implementation don't use a LogWriter.
|
Logger |
getParentLogger()
Return the parent Logger of all the Loggers used by this data source.
|
String |
getPassword()
Gets the password to connect with by default.
|
int |
getPortNumber()
Gets the port which the PostgreSQL server is listening on for TCP/IP connections.
|
PreferQueryMode |
getPreferQueryMode() |
int |
getPreparedStatementCacheQueries() |
int |
getPreparedStatementCacheSizeMiB() |
int |
getPrepareThreshold() |
String |
getProperty(PGProperty property) |
String |
getProperty(String name) |
int |
getProtocolVersion() |
boolean |
getReadOnly() |
int |
getReceiveBufferSize() |
Reference |
getReference()
Retrieves the Reference of this object.
|
String |
getReplication() |
boolean |
getReWriteBatchedInserts() |
int |
getSendBufferSize() |
String |
getServerName()
Gets the name of the host the PostgreSQL database is running on.
|
String |
getSocketFactory() |
String |
getSocketFactoryArg() |
int |
getSocketTimeout() |
boolean |
getSsl() |
String |
getSslCert() |
String |
getSslfactory() |
String |
getSslFactoryArg() |
String |
getSslHostnameVerifier() |
String |
getSslKey() |
String |
getSslMode() |
String |
getSslPassword() |
String |
getSslPasswordCallback() |
String |
getSslRootCert() |
String |
getSspiServiceClass() |
String |
getStringType() |
String |
getTargetServerType() |
boolean |
getTcpKeepAlive() |
int |
getUnknownLength() |
String |
getUrl()
Generates a
DriverManager URL from the other properties supplied. |
String |
getURL()
Generates a
DriverManager URL from the other properties supplied. |
String |
getUser()
Gets the user to connect as by default.
|
boolean |
getUseSpNego() |
void |
initializeFrom(BaseDataSource source) |
boolean |
isColumnSanitiserDisabled() |
protected void |
readBaseObject(ObjectInputStream in) |
void |
setAllowEncodingChanges(boolean allow) |
void |
setApplicationName(String applicationName) |
void |
setAssumeMinServerVersion(String minVersion) |
void |
setAutosave(AutoSave autoSave) |
void |
setBinaryTransfer(boolean enabled) |
void |
setBinaryTransferDisable(String oidList) |
void |
setBinaryTransferEnable(String oidList) |
void |
setCancelSignalTimeout(int seconds) |
void |
setConnectTimeout(int connectTimeout) |
void |
setCurrentSchema(String currentSchema) |
void |
setDatabaseMetadataCacheFields(int cacheSize) |
void |
setDatabaseMetadataCacheFieldsMiB(int cacheSize) |
void |
setDatabaseName(String databaseName)
Sets the name of the PostgreSQL database, running on the server identified by the serverName
property.
|
void |
setDefaultRowFetchSize(int fetchSize) |
void |
setDisableColumnSanitiser(boolean disableColumnSanitiser) |
void |
setFromReference(Reference ref) |
void |
setGssLib(String lib) |
void |
setHostRecheckSeconds(int hostRecheckSeconds) |
void |
setJaasApplicationName(String name) |
void |
setJaasLogin(boolean doLogin) |
void |
setKerberosServerName(String serverName) |
void |
setLoadBalanceHosts(boolean loadBalanceHosts) |
void |
setLoggerFile(String loggerFile) |
void |
setLoggerLevel(String loggerLevel) |
void |
setLoginTimeout(int loginTimeout)
Sets the maximum time in seconds that this data source will wait
while attempting to connect to a database.
|
void |
setLogUnclosedConnections(boolean enabled) |
void |
setLogWriter(PrintWriter printWriter)
This implementation don't use a LogWriter.
|
void |
setPassword(String password)
Sets the password to connect with by default.
|
void |
setPortNumber(int portNumber)
Gets the port which the PostgreSQL server is listening on for TCP/IP connections.
|
void |
setPreferQueryMode(PreferQueryMode preferQueryMode) |
void |
setPreparedStatementCacheQueries(int cacheSize) |
void |
setPreparedStatementCacheSizeMiB(int cacheSize) |
void |
setPrepareThreshold(int count) |
void |
setProperty(PGProperty property,
String value) |
void |
setProperty(String name,
String value) |
void |
setProtocolVersion(int protocolVersion) |
void |
setReadOnly(boolean readOnly) |
void |
setReceiveBufferSize(int nbytes) |
void |
setReplication(String replication) |
void |
setReWriteBatchedInserts(boolean reWrite) |
void |
setSendBufferSize(int nbytes) |
void |
setServerName(String serverName)
Sets the name of the host the PostgreSQL database is running on.
|
void |
setSocketFactory(String socketFactoryClassName) |
void |
setSocketFactoryArg(String socketFactoryArg) |
void |
setSocketTimeout(int seconds) |
void |
setSsl(boolean enabled) |
void |
setSslCert(String file) |
void |
setSslfactory(String classname) |
void |
setSslFactoryArg(String arg) |
void |
setSslHostnameVerifier(String className) |
void |
setSslKey(String file) |
void |
setSslMode(String mode) |
void |
setSslPassword(String password) |
void |
setSslPasswordCallback(String className) |
void |
setSslRootCert(String file) |
void |
setSspiServiceClass(String serviceClass) |
void |
setStringType(String stringType) |
void |
setTargetServerType(String targetServerType) |
void |
setTcpKeepAlive(boolean enabled) |
void |
setUnknownLength(int unknownLength) |
void |
setUrl(String url)
Sets properties from a
DriverManager URL. |
void |
setURL(String url)
Sets properties from a
DriverManager URL. |
void |
setUser(String user)
Sets the user to connect as by default.
|
void |
setUseSpNego(boolean use) |
protected void |
writeBaseObject(ObjectOutputStream out) |
public Connection getConnection() throws SQLException
SQLException - Occurs when the database connection cannot be established.public Connection getConnection(String user, String password) throws SQLException
user - userpassword - passwordSQLException - Occurs when the database connection cannot be established.public PrintWriter getLogWriter()
getLogWriter in interface CommonDataSourceCommonDataSource.setLogWriter(java.io.PrintWriter)public void setLogWriter(PrintWriter printWriter)
setLogWriter in interface CommonDataSourceprintWriter - Not usedCommonDataSource.getLogWriter()public String getServerName()
public void setServerName(String serverName)
serverName - name of the host the PostgreSQL database is running onpublic String getDatabaseName()
public void setDatabaseName(String databaseName)
databaseName - name of the PostgreSQL databasepublic abstract String getDescription()
public String getUser()
public void setUser(String user)
user - user to connect as by defaultpublic String getPassword()
public void setPassword(String password)
password - password to connect with by defaultpublic int getPortNumber()
public void setPortNumber(int portNumber)
portNumber - port which the PostgreSQL server is listening on for TCP/IPpublic int getLoginTimeout()
javax.sql.CommonDataSourceDataSource object is created, the login timeout is
initially zero.getLoginTimeout in interface CommonDataSourcePGProperty.LOGIN_TIMEOUTpublic void setLoginTimeout(int loginTimeout)
javax.sql.CommonDataSourceSets the maximum time in seconds that this data source will wait
while attempting to connect to a database. A value of zero
specifies that the timeout is the default system timeout
if there is one; otherwise, it specifies that there is no timeout.
When a DataSource object is created, the login timeout is
initially zero.
setLoginTimeout in interface CommonDataSourceloginTimeout - login timeoutPGProperty.LOGIN_TIMEOUTpublic int getConnectTimeout()
PGProperty.CONNECT_TIMEOUTpublic void setConnectTimeout(int connectTimeout)
connectTimeout - connect timeoutPGProperty.CONNECT_TIMEOUTpublic int getProtocolVersion()
PGProperty.PROTOCOL_VERSIONpublic void setProtocolVersion(int protocolVersion)
protocolVersion - protocol versionPGProperty.PROTOCOL_VERSIONpublic int getReceiveBufferSize()
PGProperty.RECEIVE_BUFFER_SIZEpublic void setReceiveBufferSize(int nbytes)
nbytes - receive buffer sizePGProperty.RECEIVE_BUFFER_SIZEpublic int getSendBufferSize()
PGProperty.SEND_BUFFER_SIZEpublic void setSendBufferSize(int nbytes)
nbytes - send buffer sizePGProperty.SEND_BUFFER_SIZEpublic void setPrepareThreshold(int count)
count - prepare thresholdPGProperty.PREPARE_THRESHOLDpublic int getPrepareThreshold()
PGProperty.PREPARE_THRESHOLDpublic int getPreparedStatementCacheQueries()
PGProperty.PREPARED_STATEMENT_CACHE_QUERIESpublic void setPreparedStatementCacheQueries(int cacheSize)
cacheSize - prepared statement cache size (number of statements per connection)PGProperty.PREPARED_STATEMENT_CACHE_QUERIESpublic int getPreparedStatementCacheSizeMiB()
PGProperty.PREPARED_STATEMENT_CACHE_SIZE_MIBpublic void setPreparedStatementCacheSizeMiB(int cacheSize)
cacheSize - statement cache size (number of megabytes per connection)PGProperty.PREPARED_STATEMENT_CACHE_SIZE_MIBpublic int getDatabaseMetadataCacheFields()
PGProperty.DATABASE_METADATA_CACHE_FIELDSpublic void setDatabaseMetadataCacheFields(int cacheSize)
cacheSize - database metadata cache fields size (number of fields cached per connection)PGProperty.DATABASE_METADATA_CACHE_FIELDSpublic int getDatabaseMetadataCacheFieldsMiB()
PGProperty.DATABASE_METADATA_CACHE_FIELDS_MIBpublic void setDatabaseMetadataCacheFieldsMiB(int cacheSize)
cacheSize - database metadata cache fields size (number of megabytes per connection)PGProperty.DATABASE_METADATA_CACHE_FIELDS_MIBpublic void setDefaultRowFetchSize(int fetchSize)
fetchSize - default fetch sizePGProperty.DEFAULT_ROW_FETCH_SIZEpublic int getDefaultRowFetchSize()
PGProperty.DEFAULT_ROW_FETCH_SIZEpublic void setUnknownLength(int unknownLength)
unknownLength - unknown lengthPGProperty.UNKNOWN_LENGTHpublic int getUnknownLength()
PGProperty.UNKNOWN_LENGTHpublic void setSocketTimeout(int seconds)
seconds - socket timeoutPGProperty.SOCKET_TIMEOUTpublic int getSocketTimeout()
PGProperty.SOCKET_TIMEOUTpublic void setCancelSignalTimeout(int seconds)
seconds - timeout that is used for sending cancel commandPGProperty.CANCEL_SIGNAL_TIMEOUTpublic int getCancelSignalTimeout()
PGProperty.CANCEL_SIGNAL_TIMEOUTpublic void setSsl(boolean enabled)
enabled - if SSL is enabledPGProperty.SSLpublic boolean getSsl()
PGProperty.SSLpublic void setSslfactory(String classname)
classname - SSL factory class namePGProperty.SSL_FACTORYpublic String getSslfactory()
PGProperty.SSL_FACTORYpublic String getSslMode()
PGProperty.SSL_MODEpublic void setSslMode(String mode)
mode - SSL modePGProperty.SSL_MODEpublic String getSslFactoryArg()
PGProperty.SSL_FACTORY_ARGpublic void setSslFactoryArg(String arg)
arg - argument forwarded to SSL factoryPGProperty.SSL_FACTORY_ARGpublic String getSslHostnameVerifier()
PGProperty.SSL_HOSTNAME_VERIFIERpublic void setSslHostnameVerifier(String className)
className - SSL hostname verifierPGProperty.SSL_HOSTNAME_VERIFIERpublic String getSslCert()
PGProperty.SSL_CERTpublic void setSslCert(String file)
file - SSL certificatePGProperty.SSL_CERTpublic String getSslKey()
PGProperty.SSL_KEYpublic void setSslKey(String file)
file - SSL keyPGProperty.SSL_KEYpublic String getSslRootCert()
PGProperty.SSL_ROOT_CERTpublic void setSslRootCert(String file)
file - SSL root certificatePGProperty.SSL_ROOT_CERTpublic String getSslPassword()
PGProperty.SSL_PASSWORDpublic void setSslPassword(String password)
password - SSL passwordPGProperty.SSL_PASSWORDpublic String getSslPasswordCallback()
PGProperty.SSL_PASSWORD_CALLBACKpublic void setSslPasswordCallback(String className)
className - SSL password callback class namePGProperty.SSL_PASSWORD_CALLBACKpublic void setApplicationName(String applicationName)
applicationName - application namePGProperty.APPLICATION_NAMEpublic String getApplicationName()
PGProperty.APPLICATION_NAMEpublic void setTargetServerType(String targetServerType)
targetServerType - target server typePGProperty.TARGET_SERVER_TYPEpublic String getTargetServerType()
PGProperty.TARGET_SERVER_TYPEpublic void setLoadBalanceHosts(boolean loadBalanceHosts)
loadBalanceHosts - load balance hostsPGProperty.LOAD_BALANCE_HOSTSpublic boolean getLoadBalanceHosts()
PGProperty.LOAD_BALANCE_HOSTSpublic void setHostRecheckSeconds(int hostRecheckSeconds)
hostRecheckSeconds - host recheck secondsPGProperty.HOST_RECHECK_SECONDSpublic int getHostRecheckSeconds()
PGProperty.HOST_RECHECK_SECONDSpublic void setTcpKeepAlive(boolean enabled)
enabled - if TCP keep alive should be enabledPGProperty.TCP_KEEP_ALIVEpublic boolean getTcpKeepAlive()
PGProperty.TCP_KEEP_ALIVEpublic void setBinaryTransfer(boolean enabled)
enabled - if binary transfer should be enabledPGProperty.BINARY_TRANSFERpublic boolean getBinaryTransfer()
PGProperty.BINARY_TRANSFERpublic void setBinaryTransferEnable(String oidList)
oidList - list of OIDs that are allowed to use binary transferPGProperty.BINARY_TRANSFER_ENABLEpublic String getBinaryTransferEnable()
PGProperty.BINARY_TRANSFER_ENABLEpublic void setBinaryTransferDisable(String oidList)
oidList - list of OIDs that are not allowed to use binary transferPGProperty.BINARY_TRANSFER_DISABLEpublic String getBinaryTransferDisable()
PGProperty.BINARY_TRANSFER_DISABLEpublic String getStringType()
PGProperty.STRING_TYPEpublic void setStringType(String stringType)
stringType - string typePGProperty.STRING_TYPEpublic boolean isColumnSanitiserDisabled()
PGProperty.DISABLE_COLUMN_SANITISERpublic boolean getDisableColumnSanitiser()
PGProperty.DISABLE_COLUMN_SANITISERpublic void setDisableColumnSanitiser(boolean disableColumnSanitiser)
disableColumnSanitiser - if column sanitizer should be disabledPGProperty.DISABLE_COLUMN_SANITISERpublic String getCurrentSchema()
PGProperty.CURRENT_SCHEMApublic void setCurrentSchema(String currentSchema)
currentSchema - current schemaPGProperty.CURRENT_SCHEMApublic boolean getReadOnly()
PGProperty.READ_ONLYpublic void setReadOnly(boolean readOnly)
readOnly - if connection should be readonlyPGProperty.READ_ONLYpublic boolean getLogUnclosedConnections()
PGProperty.LOG_UNCLOSED_CONNECTIONSpublic void setLogUnclosedConnections(boolean enabled)
enabled - true if driver should log unclosed connectionsPGProperty.LOG_UNCLOSED_CONNECTIONSpublic String getAssumeMinServerVersion()
PGProperty.ASSUME_MIN_SERVER_VERSIONpublic void setAssumeMinServerVersion(String minVersion)
minVersion - assumed minimal server versionPGProperty.ASSUME_MIN_SERVER_VERSIONpublic String getJaasApplicationName()
PGProperty.JAAS_APPLICATION_NAMEpublic void setJaasApplicationName(String name)
name - JAAS application namePGProperty.JAAS_APPLICATION_NAMEpublic boolean getJaasLogin()
PGProperty.JAAS_LOGINpublic void setJaasLogin(boolean doLogin)
doLogin - true if perform JAAS login before GSS authenticationPGProperty.JAAS_LOGINpublic String getKerberosServerName()
PGProperty.KERBEROS_SERVER_NAMEpublic void setKerberosServerName(String serverName)
serverName - Kerberos server namePGProperty.KERBEROS_SERVER_NAMEpublic boolean getUseSpNego()
PGProperty.USE_SPNEGOpublic void setUseSpNego(boolean use)
use - true if use SPNEGOPGProperty.USE_SPNEGOpublic String getGssLib()
PGProperty.GSS_LIBpublic void setGssLib(String lib)
lib - GSS mode: auto, sspi, or gssapiPGProperty.GSS_LIBpublic String getSspiServiceClass()
PGProperty.SSPI_SERVICE_CLASSpublic void setSspiServiceClass(String serviceClass)
serviceClass - SSPI service classPGProperty.SSPI_SERVICE_CLASSpublic boolean getAllowEncodingChanges()
PGProperty.ALLOW_ENCODING_CHANGESpublic void setAllowEncodingChanges(boolean allow)
allow - if connection allows encoding changesPGProperty.ALLOW_ENCODING_CHANGESpublic String getSocketFactory()
PGProperty.SOCKET_FACTORYpublic void setSocketFactory(String socketFactoryClassName)
socketFactoryClassName - socket factory class namePGProperty.SOCKET_FACTORYpublic String getSocketFactoryArg()
PGProperty.SOCKET_FACTORY_ARGpublic void setSocketFactoryArg(String socketFactoryArg)
socketFactoryArg - socket factory argumentPGProperty.SOCKET_FACTORY_ARGpublic void setReplication(String replication)
replication - set to 'database' for logical replication or 'true' for physical replicationPGProperty.REPLICATIONpublic String getReplication()
PGProperty.REPLICATIONpublic String getLoggerLevel()
PGProperty.LOGGER_LEVELpublic void setLoggerLevel(String loggerLevel)
loggerLevel - of the JDBC DriverPGProperty.LOGGER_LEVELpublic String getLoggerFile()
PGProperty.LOGGER_FILEpublic void setLoggerFile(String loggerFile)
loggerFile - File output of the Logger.PGProperty.LOGGER_LEVELpublic String getUrl()
DriverManager URL from the other properties supplied.DriverManager URL from the other properties suppliedpublic String getURL()
DriverManager URL from the other properties supplied.DriverManager URL from the other properties suppliedpublic void setUrl(String url)
DriverManager URL.url - properties to setpublic void setURL(String url)
DriverManager URL.
Added to follow convention used in other DBMS.url - properties to setpublic String getProperty(String name) throws SQLException
SQLExceptionpublic void setProperty(String name, String value) throws SQLException
SQLExceptionpublic String getProperty(PGProperty property)
public void setProperty(PGProperty property, String value)
protected Reference createReference()
public Reference getReference() throws NamingException
javax.naming.ReferenceablegetReference in interface ReferenceableNamingException - If a naming exception was encountered
while retrieving the reference.public void setFromReference(Reference ref)
protected void writeBaseObject(ObjectOutputStream out) throws IOException
IOExceptionprotected void readBaseObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic void initializeFrom(BaseDataSource source) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic PreferQueryMode getPreferQueryMode()
PGProperty.PREFER_QUERY_MODEpublic void setPreferQueryMode(PreferQueryMode preferQueryMode)
preferQueryMode - extended, simple, extendedForPrepared, or extendedCacheEverythingPGProperty.PREFER_QUERY_MODEpublic AutoSave getAutosave()
PGProperty.AUTOSAVEpublic void setAutosave(AutoSave autoSave)
autoSave - connection configuration regarding automatic per-query savepointsPGProperty.AUTOSAVEpublic boolean getReWriteBatchedInserts()
PGProperty.REWRITE_BATCHED_INSERTSpublic void setReWriteBatchedInserts(boolean reWrite)
reWrite - boolean value to set the property in the properties collectionPGProperty.REWRITE_BATCHED_INSERTSpublic Logger getParentLogger()
javax.sql.CommonDataSourcegetParentLogger in interface CommonDataSourceCopyright © 2018 PostgreSQL Global Development Group. All rights reserved.