Top Description Fields Constructors Methods
org.postgresql.ds.common

public abstract Class BaseDataSource

extends Object
implements CommonDataSource, Referenceable
Class Inheritance
All Implemented Interfaces
javax.naming.Referenceable, javax.sql.CommonDataSource
Known Direct Subclasses
org.postgresql.xa.PGXADataSource, org.postgresql.ds.PGConnectionPoolDataSource, org.postgresql.ds.PGPoolingDataSource, org.postgresql.ds.PGSimpleDataSource
Static Imports
org.postgresql.util.internal.Nullness.castNonNull

Base class for data sources and related classes.
Author
Aaron Mulder ([email protected])

Field Summary

Modifier and TypeField and Description
private @Nullable String
private static final Logger
private @Nullable String
private int[]
private Properties
private String[]
private @Nullable String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Reference

Returns:

reference using the appropriate object factory
createReference
()

Generates a reference using the appropriate object factory.

public boolean
public int
public int
public boolean

Returns:

if connection allows encoding changes
getAllowEncodingChanges
()

public String

Returns:

application name
getApplicationName
()

public @Nullable String

Returns:

assumed minimal server version
getAssumeMinServerVersion
()

public @Nullable String

Returns:

the class name to use for the Authentication Plugin. This can be null in which case the default password authentication plugin will be used
getAuthenticationPluginClassName
()

public AutoSave

Returns:

connection configuration regarding automatic per-query savepoints
getAutosave
()

public boolean

Returns:

true if binary transfer is enabled
getBinaryTransfer
()

public String

Returns:

list of OIDs that are not allowed to use binary transfer
getBinaryTransferDisable
()

public String

Returns:

list of OIDs that are allowed to use binary transfer
getBinaryTransferEnable
()

public int

Returns:

timeout that is used for sending cancel command in seconds
getCancelSignalTimeout
()

public boolean

Returns:

boolean indicating property set
getCleanupSavepoints
()

see PGProperty#CLEANUP_SAVEPOINTS

public Connection

Returns:

A valid database connection.
getConnection
()

Gets a connection to the PostgreSQL database.

public Connection

Returns:

A valid database connection.
getConnection
(@Nullable String
user
user
,
@Nullable String
password
password
)

Gets a connection to the PostgreSQL database.

public int

Returns:

connect timeout
getConnectTimeout
()

public @Nullable String

Returns:

current schema
getCurrentSchema
()

public int

Returns:

database metadata cache fields size (number of fields cached per connection)
getDatabaseMetadataCacheFields
()

public int

Returns:

database metadata cache fields size (number of megabytes per connection)
getDatabaseMetadataCacheFieldsMiB
()

public @Nullable String

Returns:

name of the PostgreSQL database
getDatabaseName
()

Gets the name of the PostgreSQL database, running on the server identified by the serverName property.

public int

Returns:

default fetch size
getDefaultRowFetchSize
()

public abstract String

Returns:

description of this DataSource-ish thing
getDescription
()

Gets a description of this DataSource-ish thing.

public boolean

Returns:

true if column sanitizer is disabled
getDisableColumnSanitiser
()

public String

Returns:

'select', "callIfNoReturn', or 'call'
getEscapeSyntaxCallMode
()

public boolean

Returns:

whether to group startup parameters or not
getGroupStartupParameters
()

This is important in pool-by-transaction scenarios in order to make sure that all the statements reaches the same connection that is being initialized.

public String

Returns:

GSS encryption mode: disable, prefer or require
getGssEncMode
()

public @Nullable String

Returns:

GSS mode: auto, sspi, or gssapi
getGssLib
()

public int

Returns:

GSS ResponseTimeout
getGssResponseTimeout
()

public boolean

Returns:

boolean indicating property is enabled or not.
getHideUnprivilegedObjects
()

public int

Returns:

host recheck seconds
getHostRecheckSeconds
()

public @Nullable String

Returns:

JAAS application name
getJaasApplicationName
()

public boolean

Returns:

true if perform JAAS login before GSS authentication
getJaasLogin
()

public @Nullable String

Returns:

Kerberos server name
getKerberosServerName
()

public boolean

Returns:

load balance hosts
getLoadBalanceHosts
()

public @Nullable String

Returns:

the localSocketAddress
getLocalSocketAddress
()

public @Nullable String

Returns:

loggerFile in properties
getLoggerFile
()
Deprecated Configure via java.util.logging

This property is no longer used by the driver and will be ignored.

public @Nullable String

Returns:

loggerLevel in properties
getLoggerLevel
()
Deprecated Configure via java.util.logging

This property is no longer used by the driver and will be ignored.

public int

Returns:

login timeout
getLoginTimeout
()

Implements javax.sql.CommonDataSource.getLoginTimeout.

Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.

public boolean

Returns:

true if driver should log include detail in server error messages
getLogServerErrorDetail
()

public boolean

Returns:

true if driver should log unclosed connections
getLogUnclosedConnections
()

public @Nullable PrintWriter
getLogWriter()

Implements javax.sql.CommonDataSource.getLogWriter.

This implementation don't use a LogWriter.

public @Nullable String
public @Nullable String

Returns:

command line options for this connection
getOptions
()

public Logger
getParentLogger()

Implements javax.sql.CommonDataSource.getParentLogger.

Return the parent Logger of all the Loggers used by this data source.

public @Nullable String

Returns:

password to connect with by default
getPassword
()

Gets the password to connect with by default.

public int

Returns:

The port, or 0 if the default port will be used.
getPortNumber
()
Deprecated use getPortNumbers()

Gets the port which the PostgreSQL server is listening on for TCP/IP connections.

public int[]

Returns:

The port(s), or 0 if the default port will be used.
getPortNumbers
()

Gets the port(s) which the PostgreSQL server is listening on for TCP/IP connections.

public PreferQueryMode

Returns:

preferred query execution mode
getPreferQueryMode
()

public int

Returns:

prepared statement cache size (number of statements per connection)
getPreparedStatementCacheQueries
()

public int

Returns:

prepared statement cache size (number of megabytes per connection)
getPreparedStatementCacheSizeMiB
()

public int

Returns:

prepare threshold
getPrepareThreshold
()

public @Nullable String
public @Nullable String
public int

Returns:

protocol version
getProtocolVersion
()

public boolean

Returns:

quoteReturningIdentifiers
getQuoteReturningIdentifiers
()

public boolean

Returns:

true if connection is readonly
getReadOnly
()

public String

Returns:

The behavior when set read only
getReadOnlyMode
()

public int

Returns:

receive buffer size
getReceiveBufferSize
()

public int
public Reference
getReference()

Implements javax.naming.Referenceable.getReference.

Retrieves the Reference of this object.

private static @Nullable String
public @Nullable String

Returns:

null, 'database', or 'true
getReplication
()

public boolean

Returns:

boolean indicating property is enabled or not.
getReWriteBatchedInserts
()

public int

Returns:

send buffer size
getSendBufferSize
()

public String

Returns:

name of the host the PostgreSQL database is running on
getServerName
()
Deprecated use getServerNames()

Gets the name of the host the PostgreSQL database is running on.

public String[]

Returns:

name of the host(s) the PostgreSQL database is running on
getServerNames
()

Gets the name of the host(s) the PostgreSQL database is running on.

public @Nullable String

Returns:

socket factory class name
getSocketFactory
()

public @Nullable String

Returns:

socket factory argument
getSocketFactoryArg
()

public int

Returns:

socket timeout
getSocketTimeout
()

public boolean

Returns:

true if SSL is enabled
getSsl
()

public @Nullable String

Returns:

className SSL hostname verifier
getSslCert
()

public @Nullable String
public @Nullable String

Returns:

SSL factory class name
getSslfactory
()

public @Nullable String

Returns:

SSL mode
getSslFactoryArg
()

public @Nullable String
public @Nullable String

Returns:

argument forwarded to SSL factory
getSslHostnameVerifier
()

public @Nullable String
public @Nullable String

Returns:

SSL certificate
getSslKey
()

public @Nullable String
public @Nullable String

Returns:

SSL mode
getSslMode
()

public @Nullable String
public @Nullable String

Returns:

SSL password
getSslPassword
()

public @Nullable String
public @Nullable String

Returns:

SSL password callback
getSslPasswordCallback
()

public @Nullable String
public int

Returns:

SSL ResponseTimeout
getSslResponseTimeout
()

public @Nullable String

Returns:

SSL root certificate
getSslRootCert
()

public @Nullable String
public @Nullable String

Returns:

SSPI service class
getSspiServiceClass
()

public @Nullable String

Returns:

string type
getStringType
()

public String

Returns:

target server type
getTargetServerType
()

public boolean

Returns:

true if TCP keep alive is enabled
getTcpKeepAlive
()

public boolean

Returns:

true if TCP no delay is enabled
getTcpNoDelay
()

public int

Returns:

unknown length
getUnknownLength
()

public String

Returns:

DriverManager URL from the other properties supplied
getUrl
()

Generates a DriverManager URL from the other properties supplied.

public String

Returns:

DriverManager URL from the other properties supplied
getURL
()

Generates a DriverManager URL from the other properties supplied.

public @Nullable String

Returns:

user to connect as by default
getUser
()

Gets the user to connect as by default.

public boolean

Returns:

true if use SPNEGO
getUseSpNego
()

public String
public void
public boolean
public boolean
public boolean

Returns:

true if column sanitizer is disabled
isColumnSanitiserDisabled
()

public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
protected void
public void
setAdaptiveFetch(boolean adaptiveFetch)

public void
setAdaptiveFetchMaximum(int adaptiveFetchMaximum)

public void
setAdaptiveFetchMinimum(int adaptiveFetchMinimum)

public void
setAllowEncodingChanges(boolean
if connection allows encoding changes
allow
)

public void
setApplicationName(@Nullable String
application name
applicationName
)

public void
setAssumeMinServerVersion(@Nullable String
assumed minimal server version
minVersion
)

public void
setAuthenticationPluginClassName(String
name of a class which implements org.postgresql.plugin.AuthenticationPlugin This class will be used to get the encoded bytes to be sent to the server as the password to authenticate the user.
className
)

public void
setAutosave(AutoSave
connection configuration regarding automatic per-query savepoints
autoSave
)

public void
setBinaryTransfer(boolean
if binary transfer should be enabled
enabled
)

public void
setBinaryTransferDisable(@Nullable String
list of OIDs that are not allowed to use binary transfer
oidList
)

public void
setBinaryTransferEnable(@Nullable String
list of OIDs that are allowed to use binary transfer
oidList
)

public void
setCancelSignalTimeout(int
timeout that is used for sending cancel command
seconds
)

public void
setCleanupSavepoints(boolean
will cleanup savepoints after a successful transaction
cleanupSavepoints
)

see PGProperty#CLEANUP_SAVEPOINTS

public void
setCleanupSavePoints(final boolean cleanupSavepoints)

public void
setConnectTimeout(int
connect timeout
connectTimeout
)

public void
setCurrentSchema(@Nullable String
current schema
currentSchema
)

public void
setDatabaseMetadataCacheFields(int
database metadata cache fields size (number of fields cached per connection)
cacheSize
)

public void
setDatabaseMetadataCacheFieldsMiB(int
database metadata cache fields size (number of megabytes per connection)
cacheSize
)

public void
setDatabaseName(@Nullable String
name of the PostgreSQL database
databaseName
)

Sets the name of the PostgreSQL database, running on the server identified by the serverName property.

public void
setDefaultRowFetchSize(int
default fetch size
fetchSize
)

public void
setDisableColumnSanitiser(boolean
if column sanitizer should be disabled
disableColumnSanitiser
)

public void
setEscapeSyntaxCallMode(@Nullable String
the call mode to use for JDBC escape call syntax
callMode
)

public void
public void
setGroupStartupParameters(boolean
whether to group startup Parameters in a transaction or not
groupStartupParameters
)

public void
setGssEncMode(@Nullable String
encryption mode: disable, prefer or require
mode
)

public void
setGssLib(@Nullable String
GSS mode: auto, sspi, or gssapi
lib
)

public void
setGssResponseTimeout(int
gss response timeout
gssResponseTimeout
)

public void
setHideUnprivilegedObjects(boolean
boolean value to set the property in the properties collection
hideUnprivileged
)

public void
setHostRecheckSeconds(int
host recheck seconds
hostRecheckSeconds
)

public void
setJaasApplicationName(@Nullable String
JAAS application name
name
)

public void
setJaasLogin(boolean
true if perform JAAS login before GSS authentication
doLogin
)

public void
setKerberosServerName(@Nullable String
Kerberos server name
serverName
)

public void
setLoadBalanceHosts(boolean
load balance hosts
loadBalanceHosts
)

public void
setLocalSocketAddress(String
local address to bind client side to
localSocketAddress
)

public void
setLoggerFile(@Nullable String
will be ignored
loggerFile
)
Deprecated Configure via java.util.logging

This property is no longer used by the driver and will be ignored.

public void
setLoggerLevel(@Nullable String
loggerLevel to set, will be ignored
loggerLevel
)
Deprecated Configure via java.util.logging

This property is no longer used by the driver and will be ignored.

public void
setLoginTimeout(int
login timeout
loginTimeout
)

Implements javax.sql.CommonDataSource.setLoginTimeout.

Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.

public void
setLogServerErrorDetail(boolean
true if driver should include detail in server error messages
enabled
)

public void
setLogUnclosedConnections(boolean
true if driver should log unclosed connections
enabled
)

public void
setLogWriter(@Nullable PrintWriter
Not used
printWriter
)

Implements javax.sql.CommonDataSource.setLogWriter.

This implementation don't use a LogWriter.

public void
public void
setOptions(@Nullable String
string to set options to
options
)

Set command line options for this connection

public void
setPassword(@Nullable String
password to connect with by default
password
)

Sets the password to connect with by default.

public void
setPortNumber(int
port which the PostgreSQL server is listening on for TCP/IP
portNumber
)
Deprecated use setPortNumbers(int[])

Sets the port which the PostgreSQL server is listening on for TCP/IP connections.

public void
setPortNumbers(@Nullable int[]
port(s) which the PostgreSQL server is listening on for TCP/IP
portNumbers
)

Sets the port(s) which the PostgreSQL server is listening on for TCP/IP connections.

public void
setPreferQueryMode(PreferQueryMode
extended, simple, extendedForPrepared, or extendedCacheEverything
preferQueryMode
)

public void
setPreparedStatementCacheQueries(int
prepared statement cache size (number of statements per connection)
cacheSize
)

public void
setPreparedStatementCacheSizeMiB(int
statement cache size (number of megabytes per connection)
cacheSize
)

public void
setPrepareThreshold(int
prepare threshold
count
)

public void
public void
public void
setProtocolVersion(int
protocol version
protocolVersion
)

public void
setQuoteReturningIdentifiers(boolean
indicate whether to quote identifiers
quoteIdentifiers
)

public void
setReadOnly(boolean
if connection should be readonly
readOnly
)

public void
setReadOnlyMode(@Nullable String
the behavior when set read only
mode
)

public void
setReceiveBufferSize(int
receive buffer size
nbytes
)

public void
setRecvBufferSize(final int nbytes)

public void
setReplication(@Nullable String
set to 'database' for logical replication or 'true' for physical replication
replication
)

public void
setReWriteBatchedInserts(boolean
boolean value to set the property in the properties collection
reWrite
)

public void
setSendBufferSize(int
send buffer size
nbytes
)

public void
setServerName(String
name of the host the PostgreSQL database is running on
serverName
)
Deprecated use setServerNames(String[])

Sets the name of the host the PostgreSQL database is running on.

public void
setServerNames(@Nullable @Nullable String[]
name of the host(s) the PostgreSQL database is running on
serverNames
)

Sets the name of the host(s) the PostgreSQL database is running on.

public void
setSocketFactory(@Nullable String
socket factory class name
socketFactoryClassName
)

public void
setSocketFactoryArg(@Nullable String
socket factory argument
socketFactoryArg
)

public void
setSocketTimeout(int
socket timeout
seconds
)

public void
setSsl(boolean
if SSL is enabled
enabled
)

public void
setSslCert(@Nullable String
SSL certificate
file
)

public void
public void
setSslfactory(String
SSL factory class name
classname
)

public void
setSslFactoryArg(@Nullable String
argument forwarded to SSL factory
arg
)

public void
public void
setSslHostnameVerifier(@Nullable String
SSL hostname verifier
className
)

public void
public void
setSslKey(@Nullable String
SSL key
file
)

public void
public void
setSslMode(@Nullable String
SSL mode
mode
)

public void
public void
setSslPassword(@Nullable String
SSL password
password
)

public void
setSslpassword(final String sslpassword)

public void
setSslPasswordCallback(@Nullable String
SSL password callback class name
className
)

public void
public void
setSslResponseTimeout(int
ssl response timeout
sslResponseTimeout
)

public void
setSslRootCert(@Nullable String
SSL root certificate
file
)

public void
public void
setSspiServiceClass(@Nullable String
SSPI service class
serviceClass
)

public void
setStringType(@Nullable String
string type
stringType
)

public void
setTargetServerType(@Nullable String
target server type
targetServerType
)

public void
setTcpKeepAlive(boolean
if TCP keep alive should be enabled
enabled
)

public void
setTcpNoDelay(boolean
if TCP no delay should be enabled
enabled
)

public void
setUnknownLength(int
unknown length
unknownLength
)

public void
setUrl(String
properties to set
url
)

Sets properties from a DriverManager URL.

public void
setURL(String
properties to set
url
)

Sets properties from a DriverManager URL.

public void
setUser(@Nullable String
user to connect as by default
user
)

Sets the user to connect as by default.

public void
setUseSpNego(boolean
true if use SPNEGO
use
)

public void
protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait