public abstract class BaseDataSource extends Object implements CommonDataSource, Referenceable
| Constructor and Description |
|---|
BaseDataSource() |
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 CommonDataSourcepublic void setLogWriter(PrintWriter printWriter)
setLogWriter in interface CommonDataSourceprintWriter - Not used@Deprecated public String getServerName()
getServerNames()public String[] getServerNames()
@Deprecated public void setServerName(String serverName)
setServerNames(String[])localhost.serverName - name of the host the PostgreSQL database is running onpublic void setServerNames(String[] serverNames)
localhost.serverNames - name of the host(s) 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 default@Deprecated public int getPortNumber()
getPortNumbers()public int[] getPortNumbers()
@Deprecated public void setPortNumber(int portNumber)
setPortNumbers(int[])portNumber - port which the PostgreSQL server is listening on for TCP/IPpublic void setPortNumbers(int[] portNumbers)
portNumbers - port(s) which the PostgreSQL server is listening on for TCP/IPpublic String getOptions()
public void setOptions(String options)
options - string to set options topublic int getLoginTimeout()
getLoginTimeout in interface CommonDataSourcePGProperty.LOGIN_TIMEOUTpublic void setLoginTimeout(int loginTimeout)
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 boolean getQuoteReturningIdentifiers()
PGProperty.QUOTE_RETURNING_IDENTIFIERSpublic void setQuoteReturningIdentifiers(boolean quoteIdentifiers)
quoteIdentifiers - indicate whether to quote identifiersPGProperty.QUOTE_RETURNING_IDENTIFIERSpublic 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 setTcpNoDelay(boolean enabled)
enabled - if TCP no delay should be enabledPGProperty.TCP_NO_DELAYpublic boolean getTcpNoDelay()
PGProperty.TCP_NO_DELAYpublic 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 String getReadOnlyMode()
PGProperty.READ_ONLY_MODEpublic void setReadOnlyMode(String mode)
mode - the behavior when set read onlyPGProperty.READ_ONLY_MODEpublic boolean getLogUnclosedConnections()
PGProperty.LOG_UNCLOSED_CONNECTIONSpublic void setLogUnclosedConnections(boolean enabled)
enabled - true if driver should log unclosed connectionsPGProperty.LOG_UNCLOSED_CONNECTIONSpublic boolean getLogServerErrorDetail()
PGProperty.LOG_SERVER_ERROR_DETAILpublic void setLogServerErrorDetail(boolean enabled)
enabled - true if driver should include detail in server error messagesPGProperty.LOG_SERVER_ERROR_DETAILpublic String getAssumeMinServerVersion()
PGProperty.ASSUME_MIN_SERVER_VERSIONpublic void setAssumeMinServerVersion(String minVersion)
minVersion - assumed minimal server versionPGProperty.ASSUME_MIN_SERVER_VERSIONpublic boolean getGroupStartupParameters()
PGProperty.GROUP_STARTUP_PARAMETERSpublic void setGroupStartupParameters(boolean groupStartupParameters)
groupStartupParameters - whether to group startup Parameters in a transaction or notPGProperty.GROUP_STARTUP_PARAMETERSpublic 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 getGssEncMode()
public void setGssEncMode(String mode)
mode - encryption mode: disable, prefer or requirepublic 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 getEscapeSyntaxCallMode()
PGProperty.ESCAPE_SYNTAX_CALL_MODEpublic void setEscapeSyntaxCallMode(String callMode)
callMode - the call mode to use for JDBC escape call syntaxPGProperty.ESCAPE_SYNTAX_CALL_MODEpublic String getReplication()
PGProperty.REPLICATIONpublic String getLocalSocketAddress()
PGProperty.LOCAL_SOCKET_ADDRESSpublic void setLocalSocketAddress(String localSocketAddress)
localSocketAddress - local address to bind client side toPGProperty.LOCAL_SOCKET_ADDRESS@Deprecated public String getLoggerLevel()
@Deprecated public void setLoggerLevel(String loggerLevel)
loggerLevel - loggerLevel to set, will be ignored@Deprecated public String getLoggerFile()
@Deprecated public void setLoggerFile(String loggerFile)
loggerFile - will be ignoredpublic 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 getAuthenticationPluginClassName()
public void setAuthenticationPluginClassName(String className)
className - name of a class which implements AuthenticationPlugin
This class will be used to get the encoded bytes to be sent to the server as the
password to authenticate the user.public 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
getReference in interface ReferenceableNamingExceptionpublic 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 getCleanupSavepoints()
public void setCleanupSavepoints(boolean cleanupSavepoints)
cleanupSavepoints - will cleanup savepoints after a successful transactionpublic boolean getReWriteBatchedInserts()
PGProperty.REWRITE_BATCHED_INSERTSpublic void setReWriteBatchedInserts(boolean reWrite)
reWrite - boolean value to set the property in the properties collectionPGProperty.REWRITE_BATCHED_INSERTSpublic boolean getHideUnprivilegedObjects()
PGProperty.HIDE_UNPRIVILEGED_OBJECTSpublic void setHideUnprivilegedObjects(boolean hideUnprivileged)
hideUnprivileged - boolean value to set the property in the properties collectionPGProperty.HIDE_UNPRIVILEGED_OBJECTSpublic String getMaxResultBuffer()
public void setMaxResultBuffer(String maxResultBuffer)
public boolean getAdaptiveFetch()
public void setAdaptiveFetch(boolean adaptiveFetch)
public int getAdaptiveFetchMaximum()
public void setAdaptiveFetchMaximum(int adaptiveFetchMaximum)
public int getAdaptiveFetchMinimum()
public void setAdaptiveFetchMinimum(int adaptiveFetchMinimum)
public Logger getParentLogger()
getParentLogger in interface CommonDataSourcepublic String getXmlFactoryFactory()
public void setXmlFactoryFactory(String xmlFactoryFactory)
public boolean isSsl()
public String getSslfactoryarg()
public void setSslfactoryarg(String arg)
public String getSslcert()
public void setSslcert(String file)
public String getSslmode()
public void setSslmode(String mode)
public String getSslhostnameverifier()
public void setSslhostnameverifier(String className)
public String getSslkey()
public void setSslkey(String file)
public String getSslrootcert()
public void setSslrootcert(String file)
public String getSslpasswordcallback()
public void setSslpasswordcallback(String className)
public String getSslpassword()
public void setSslpassword(String sslpassword)
public int getRecvBufferSize()
public void setRecvBufferSize(int nbytes)
public boolean isAllowEncodingChanges()
public boolean isLogUnclosedConnections()
public boolean isTcpKeepAlive()
public boolean isReadOnly()
public boolean isDisableColumnSanitiser()
public boolean isLoadBalanceHosts()
public boolean isCleanupSavePoints()
public void setCleanupSavePoints(boolean cleanupSavepoints)
public boolean isReWriteBatchedInserts()
Copyright © 2025 PostgreSQL Global Development Group. All rights reserved.