1. Home
  2. Home
  3. Documentation
  4. Reference
  5. Connection properties
Last reviewed Edit this page on GitHub

Connection properties

Every property the driver recognises, with its default, type, and the pgjdbc version that introduced it. Filter the table by name to narrow down to a specific topic; for in-context discussions see the topical pages in Connect and Security .

NameTypeDefaultVersionsDescription
adaptiveFetchbooleanfalse
  • since 42.2.11
Specifies if number of rows fetched in ResultSet should be adaptive to maxResultBuffer and max row size.
adaptiveFetchMaximumint-1
  • since 42.2.11
Specifies maximum number of rows used by adaptive fetch.
adaptiveFetchMinimumint0
  • since 42.2.11
Specifies minimum number of rows used by adaptive fetch.
allowEncodingChangesbooleanfalse
  • since 9.4
Allow for changes in client_encoding
ApplicationNamestringPostgreSQL JDBC Driver
  • since 9.4
Name of the Application (backend >= 9.0)
assumeMinServerVersionstring
  • since 9.4
Assume the server is at least that version
authenticationPluginClassNameclass
  • since 42.2.25
Name of class which implements AuthenticationPlugin
autosaveenumnever
  • since 9.4-1206
Specifies what the driver should do if a query fails. In autosave=always mode, JDBC driver sets a savepoint before each query, and rolls back to that savepoint in case of failure. In autosave=never mode (default), no savepoint dance is made ever. In autosave=conservative mode, safepoint is set for each query, however the rollback is done only for rare cases like ‘cached statement cannot change return type’ or ‘statement XXX is not valid’ so JDBC driver rollsback and retries
binaryTransferbooleantrue
  • since 9.4
Enable binary transfer for supported built-in types if possible. Setting this to false disables any binary transfer unless it’s individually activated for each type with binaryTransferEnable.
binaryTransferDisablestring
  • since 9.4
Comma separated list of types to disable binary transfer. Either OID numbers or names. Overrides values in the driver default set and values set with binaryTransferEnable.
binaryTransferEnablestring
  • since 9.4
Comma separated list of types to enable binary transfer. Either OID numbers or names.
cancelSignalTimeoutintseconds10
  • since 9.4
The timeout that is used for sending cancel command.
channelBindingenumprefer
  • since 42.7.0
This option controls the client’s use of channel binding.
cleanupSavepointsbooleanfalse
  • since 42.2.9
Determine whether SAVEPOINTS used in AUTOSAVE will be released per query or not
connectTimeoutintseconds10
  • since 9.4
The timeout value in seconds used for socket connect operations.
convertBooleanToNumericbooleanfalse
  • since 9.4
Enable automatic conversion of PostgreSQL boolean values (’t’/‘f’) to numeric types (1/0)
currentSchemastring
  • since 9.4
Specify the schema (or several schema separated by commas) to be set in the search-path
databaseMetadataCacheFieldsint65536
  • since 9.4
Specifies the maximum number of fields to be cached per connection. A value of {@code 0} disables the cache.
databaseMetadataCacheFieldsMiBint5
  • since 9.4
Specifies the maximum size (in megabytes) of fields to be cached per connection. A value of {@code 0} disables the cache.
defaultRowFetchSizeint0
  • since 9.4
Positive number of rows that should be fetched from the database when more rows are needed for ResultSet by each fetch iteration
disableColumnSanitiserbooleanfalse
  • since 9.4
Enable optimization that disables column name sanitiser
escapeSyntaxCallModeenumselect
  • since 42.2.9
Specifies how the driver transforms JDBC escape call syntax into underlying SQL, for invoking procedures or functions. (backend >= 11)In escapeSyntaxCallMode=select mode (the default), the driver always uses a SELECT statement (allowing function invocation only).In escapeSyntaxCallMode=callIfNoReturn mode, the driver uses a CALL statement (allowing procedure invocation) if there is no return parameter specified, otherwise the driver uses a SELECT statement.In escapeSyntaxCallMode=call mode, the driver always uses a CALL statement (allowing procedure invocation only).
flushCacheOnDdlbooleantrue
  • since 42.7.12
Invalidate the prepared-statement cache when a CREATE/DROP/ALTER CommandComplete is observed (default true). Disable for legacy behavior that surfaces ‘cached plan must not change result type’.
groupStartupParametersbooleanfalse
  • since 42.7.0
  • deprecated in 42.7.6
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.
gssEncModeenumallow
  • since 42.2.17
Force Encoded GSS Mode
gsslibenumauto
  • since 9.4
Force SSSPI or GSSAPI
gssResponseTimeoutintmilliseconds5000
  • since 42.5.2
Time in milliseconds we wait for a response from the server after requesting a GSS upgrade
gssUseDefaultCredsbooleanfalse
  • since 9.4
Use the default GSS credentials the process already has, rather than a JAAS login
hideUnprivilegedObjectsbooleanfalse
  • since 9.4
Enable hiding of database objects for which the current user has no privileges granted from the DatabaseMetaData
hostRecheckSecondsintseconds10
  • since 42.2.0
Specifies period (seconds) after which the host status is checked again in case it has changed
jaasApplicationNamestringpgjdbc
  • since 9.4
Specifies the name of the JAAS system or application login configuration.
jaasLoginbooleantrue
  • since 42.2.0
Login with JAAS before doing GSSAPI authentication
kerberosServerNamestring
  • since 9.4
The Kerberos service name to use when authenticating with GSSAPI.
loadBalanceHostsbooleanfalse
  • since 42.2.0
If disabled hosts are connected in the given order. If enabled hosts are chosen randomly from the set of suitable candidates
localSocketAddressstring
  • since 9.4
Local Socket address, if set bind the client side of the socket to this address
loggerFilestring
  • since 9.4
  • deprecated in 42.0.0
File name output of the Logger
loggerLevelenum
  • since 9.4
  • deprecated in 42.0.0
Logger level of the driver
loginTimeoutintseconds0
  • since 9.4
Specify how long in seconds to wait for establishment of a database connection.
logServerErrorDetailbooleantrue
  • since 42.2.24
Include full server error detail in exception messages. If disabled then only the error itself will be included.
logUnclosedConnectionsbooleanfalse
  • since 9.4
When connections that are not explicitly closed are garbage collected, log the stacktrace from the opening of the connection to trace the leak source
maxResultBufferstringsize, e.g. 2M
  • since 42.2.10
Specifies size of buffer during fetching result set. Can be specified as specified size or percent of heap memory.
maxSendBufferSizeintbytes8192
  • since 42.7.4
Maximum amount of bytes buffered before sending to the backend
optionsstring
  • since 9.4
Specify ‘options’ connection initialization parameter.
passwordstring
  • since 9.4
Password to use when authenticating.
pemKeyAlgorithmstringRSA
  • since 42.7.9
Algorithm of the PEM key
PGDBNAMEstring
  • since 9.4
Database name to connect to (may be specified directly in the JDBC URL)
PGHOSTstringlocalhost
  • since 9.4
Hostname of the PostgreSQL server (may be specified directly in the JDBC URL)
PGPORTint5432
  • since 9.4
Port of the PostgreSQL server (may be specified directly in the JDBC URL)
preferQueryModeenumextended
  • since 42.1.2
Specifies which mode is used to execute queries to database: simple means (‘Q’ execute, no parse, no bind, text mode only), extended means always use bind/execute messages, extendedForPrepared means extended for prepared statements only, extendedCacheEverything means use extended protocol and try cache every statement (including Statement.execute(String sql)) in a query cache.
preparedStatementCacheQueriesint256
  • since 9.4
Specifies the maximum number of entries in per-connection cache of prepared statements. A value of {@code 0} disables the cache.
preparedStatementCacheSizeMiBint5
  • since 9.4
Specifies the maximum size (in megabytes) of a per-connection prepared statement cache. A value of {@code 0} disables the cache.
prepareThresholdint5
  • since 9.4
Statement prepare threshold. A value of {@code -1} stands for forceBinary
protocolVersionenum3
  • since 9.4
Force use of a particular protocol version when connecting, currently only version 3 is supported.
queryTimeoutintseconds0
  • since 9.4
The timeout value in seconds that the driver will wait for a query to execute.
quoteReturningIdentifiersbooleantrue
  • since 42.7.9
Quote identifiers provided in returning array
readOnlybooleanfalse
  • since 9.4
Puts this connection in read-only mode
readOnlyModeenumtransaction
  • since 42.2.15
Controls the behavior when a connection is set to be read only, one of ‘ignore’, ’transaction’, or ‘always’ When ‘ignore’, setting readOnly has no effect. When ’transaction’ setting readOnly to ’true’ will cause transactions to BEGIN READ ONLY if autocommit is ‘false’. When ‘always’ setting readOnly to ’true’ will set the session to READ ONLY if autoCommit is ’true’ and the transaction to BEGIN READ ONLY if autocommit is ‘false’.
receiveBufferSizeintbytes-1
  • since 9.4
Socket read buffer size
replicationstring
  • since 9.4
Connection parameter passed in startup message, one of ’true’ or ‘database’ Passing ’true’ tells the backend to go into walsender mode, wherein a small set of replication commands can be issued instead of SQL statements. Only the simple query protocol can be used in walsender mode. Passing ‘database’ as the value instructs walsender to connect to the database specified in the dbname parameter, which will allow the connection to be used for logical replication from that database. (backend >= 9.4)
requireAuthstring
  • since 42.7.0
Comma-separated list of acceptable authentication methods. Use ‘!’ prefix to reject methods (e.g., ‘!password’ to reject cleartext). Supported: password, md5, gss, sspi, scram-sha-256, none
reWriteBatchedInsertsbooleanfalse
  • since 42.2.1
Enable optimization to rewrite and collapse compatible INSERT statements that are batched.
scramMaxIterationsint100000
  • since 42.7.11
Maximum PBKDF2 iteration count accepted from the server during SCRAM authentication. A value of zero disables this check.
sendBufferSizeintbytes-1
  • since 9.4
Socket write buffer size
servicestring
  • since 42.2.0
Service name to be searched in pg_service.conf resource
socketFactoryclass
  • since 9.4
Specify a socket factory for socket creation
socketFactoryArgstring
  • since 9.4
Argument forwarded to constructor of SocketFactory class.
socketTimeoutintseconds0
  • since 9.4
The timeout value in seconds max(2147484) used for socket read operations.
sslstring
  • since 9.4
Control use of SSL (any non-null value causes SSL to be required)
sslcertstring
  • since 9.4
The location of the client’s SSL certificate
sslfactoryclassorg.postgresql.ssl.LibPQFactory
  • since 9.4
Provide a SSLSocketFactory class when using SSL.
sslfactoryargstring
  • since 9.4
Argument forwarded to constructor of SSLSocketFactory class.
sslhostnameverifierclass
  • since 9.4
A class, implementing javax.net.ssl.HostnameVerifier that can verify the server
sslkeystring
  • since 9.4
The location of the client’s PKCS#8 SSL key
sslmodeenum
  • since 9.4-1200
Parameter governing the use of SSL
sslNegotiationenumpostgres
  • since 42.7.4
This option controls whether the driver will perform its protocol negotiation to request encryption from the server or will just directly make a standard SSL connection. Traditional PostgreSQL protocol negotiation is the default and the most flexible with different server configurations. If the server is known to support direct SSL connections then the latter requires one fewer round trip reducing connection latency and also allows the use of protocol agnostic SSL network tools.
sslpasswordstring
  • since 9.4
The password for the client’s ssl key (ignored if sslpasswordcallback is set)
sslpasswordcallbackclass
  • since 9.4
A class, implementing javax.security.auth.callback.CallbackHandler that can handle PasswordCallback for the ssl password.
sslResponseTimeoutintmilliseconds5000
  • since 42.5.2
Time in milliseconds we wait for a response from the server after requesting SSL upgrade
sslrootcertstring
  • since 9.4
The location of the root certificate for authenticating the server.
sspiServiceClassstringPOSTGRES
  • since 9.4
The Windows SSPI service class for SPN
stringtypeenum
  • since 9.4
The type to bind String parameters as (usually ‘varchar’, ‘unspecified’ allows implicit casting to other types)
targetServerTypeenumany
  • since 42.2.0
Specifies what kind of server to connect
tcpKeepAlivebooleanfalse
  • since 9.4
Enable or disable TCP keep-alive. The default is {@code false}.
tcpNoDelaybooleantrue
  • since 9.4
Enable or disable TCP no delay. The default is (@code true}.
unknownLengthint2147483647
  • since 9.4
Specifies the length to return for types of unknown length
userstring
  • since 9.4
Username to connect to the database as.
useSpnegobooleanfalse
  • since 9.4
Use SPNEGO in SSPI authentication requests
xmlFactoryFactoryclass
  • since 42.7.8
Factory class to instantiate factories for XML processing