Package org.postgresql
Enum PGProperty
- java.lang.Object
-
- java.lang.Enum<PGProperty>
-
- org.postgresql.PGProperty
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<PGProperty>
public enum PGProperty extends java.lang.Enum<PGProperty>
All connection parameters that can be either set in JDBC URL, in Driver properties or in datasource setters.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALLOW_ENCODING_CHANGESWhen using the V3 protocol the driver monitors changes in certain server configuration parameters that should not be touched by end users.APPLICATION_NAMEThe application name (require server version >= 9.0)ASSUME_MIN_SERVER_VERSIONAssume the server is at least that versionBINARY_TRANSFERUse binary format for sending and receiving data if possible.BINARY_TRANSFER_DISABLEComma separated list of types to disable binary transfer.BINARY_TRANSFER_ENABLEComma separated list of types to enable binary transfer.CHARSETThe character set to use for data sent to the database or received from the database.COMPATIBLEForce compatibility of some features with an older version of the driver.CONNECT_TIMEOUTThe timeout value used for socket connect operations.CURRENT_SCHEMASpecify the schema to be set in the search-path.DISABLE_COLUMN_SANITISEREnable optimization that disables column name sanitiser.GSS_LIBForce one of SSPI (Windows transparent single-sign-on) GSSAPI (Kerberos, via JSSE) to be used when the server requests Kerberos or SSPI authentication.HOST_RECHECK_SECONDSJAAS_APPLICATION_NAMESpecifies the name of the JAAS system or application login configuration.KERBEROS_SERVER_NAMEThe Kerberos service name to use when authenticating with GSSAPI.LOAD_BALANCE_HOSTSLOG_LEVELThe loglevel.LOG_UNCLOSED_CONNECTIONSWhen connections that are not explicitly closed are garbage collected, log the stacktrace from the opening of the connection to trace the leak source.LOGIN_TIMEOUTSpecify how long to wait for establishment of a database connection.PASSWORDPassword to use when authenticating.PG_DBNAMEDatabase name to connect to (may be specified directly in the JDBC URL)PG_HOSTHostname of the PostgreSQL server (may be specified directly in the JDBC URL)PG_PORTPort of the PostgreSQL server (may be specified directly in the JDBC URL)PREPARE_THRESHOLDSets the default threshold for enabling server-side prepare.PROTOCOL_VERSIONForce use of a particular protocol version when connecting, if set, disables protocol version fallback.READ_ONLYPuts this connection in read-only mode.RECEIVE_BUFFER_SIZESocket read buffer size (SO_RECVBUF).SEND_BUFFER_SIZESocket write buffer size (SO_SNDBUF).SOCKET_TIMEOUTThe timeout value used for socket read operations.SSLControl use of SSL (any non-null value causes SSL to be required).SSL_CERTFile containing the SSL Certificate.SSL_FACTORYClassname of the SSL Factory to use (instance ofjavax.net.ssl.SSLSocketFactory).SSL_FACTORY_ARGThe String argument to give to the constructor of the SSL FactorySSL_HOSTNAME_VERIFIERClassname of the SSL HostnameVerifier to use (instance ofjavax.net.ssl.HostnameVerifier).SSL_KEYFile containing the SSL Key.SSL_MODEParameter governing the use of SSL.SSL_PASSWORDThe SSL password to use in the default CallbackHandler.SSL_PASSWORD_CALLBACKThe classname instantiatingjavax.security.auth.callback.CallbackHandlerto useSSL_ROOT_CERTFile containing the root certificate when validating server (sslmode=verify-caorverify-full).SSPI_SERVICE_CLASSSpecifies the name of the SSPI service class that forms the service class part of the SPN.STRING_TYPEBind String to eitherunspecifiedorvarchar.TARGET_SERVER_TYPETCP_KEEP_ALIVEEnable or disable TCP keep-alive.UNKNOWN_LENGTHSpecifies the length to return for types of unknown length.USE_SPNEGOUse SPNEGO in SSPI authentication requestsUSERUsername to connect to the database as.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PGPropertyforName(java.lang.String name)java.lang.Stringget(java.util.Properties properties)Returns the value of the connection parameters according to the givenPropertiesor the default valuebooleangetBoolean(java.util.Properties properties)Return the boolean value for this connection parameter in the givenPropertiesjava.lang.String[]getChoices()Returns the available values for this connection parameterjava.lang.StringgetDefaultValue()Returns the default value for this connection parameterintgetInt(java.util.Properties properties)Return the int value for this connection parameter in the givenPropertiesjava.lang.IntegergetInteger(java.util.Properties properties)Return theIntegervalue for this connection parameter in the givenPropertiesintgetIntNoCheck(java.util.Properties properties)Return the int value for this connection parameter in the givenProperties.java.lang.StringgetName()Returns the name of the connection parameter.booleanisPresent(java.util.Properties properties)Test whether this property is present in the givenPropertiesvoidset(java.util.Properties properties, boolean value)Set the boolean value for this connection parameter in the givenPropertiesvoidset(java.util.Properties properties, int value)Set the int value for this connection parameter in the givenPropertiesvoidset(java.util.Properties properties, java.lang.String value)Set the value for this connection parameter in the givenPropertiesjava.sql.DriverPropertyInfotoDriverPropertyInfo(java.util.Properties properties)Convert this connection parameter and the value read from the givenPropertiesinto aDriverPropertyInfostatic PGPropertyvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static PGProperty[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PG_DBNAME
public static final PGProperty PG_DBNAME
Database name to connect to (may be specified directly in the JDBC URL)
-
PG_HOST
public static final PGProperty PG_HOST
Hostname of the PostgreSQL server (may be specified directly in the JDBC URL)
-
PG_PORT
public static final PGProperty PG_PORT
Port of the PostgreSQL server (may be specified directly in the JDBC URL)
-
USER
public static final PGProperty USER
Username to connect to the database as.
-
PASSWORD
public static final PGProperty PASSWORD
Password to use when authenticating.
-
PROTOCOL_VERSION
public static final PGProperty PROTOCOL_VERSION
Force use of a particular protocol version when connecting, if set, disables protocol version fallback.
-
LOG_LEVEL
public static final PGProperty LOG_LEVEL
The loglevel. Can be one ofDriver.DEBUG,Driver.INFO,Driver.OFF.
-
PREPARE_THRESHOLD
public static final PGProperty PREPARE_THRESHOLD
Sets the default threshold for enabling server-side prepare. A value of-1stands for forceBinary
-
BINARY_TRANSFER
public static final PGProperty BINARY_TRANSFER
Use binary format for sending and receiving data if possible.
-
COMPATIBLE
public static final PGProperty COMPATIBLE
Force compatibility of some features with an older version of the driver.
-
READ_ONLY
public static final PGProperty READ_ONLY
Puts this connection in read-only mode.
-
BINARY_TRANSFER_ENABLE
public static final PGProperty BINARY_TRANSFER_ENABLE
Comma separated list of types to enable binary transfer. Either OID numbers or names
-
BINARY_TRANSFER_DISABLE
public static final PGProperty BINARY_TRANSFER_DISABLE
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.
-
STRING_TYPE
public static final PGProperty STRING_TYPE
Bind String to eitherunspecifiedorvarchar. Default isvarcharfor 8.0+ backends.
-
UNKNOWN_LENGTH
public static final PGProperty UNKNOWN_LENGTH
Specifies the length to return for types of unknown length.
-
LOG_UNCLOSED_CONNECTIONS
public static final PGProperty LOG_UNCLOSED_CONNECTIONS
When connections that are not explicitly closed are garbage collected, log the stacktrace from the opening of the connection to trace the leak source.
-
DISABLE_COLUMN_SANITISER
public static final PGProperty DISABLE_COLUMN_SANITISER
Enable optimization that disables column name sanitiser.
-
SSL
public static final PGProperty SSL
Control use of SSL (any non-null value causes SSL to be required).
-
SSL_MODE
public static final PGProperty SSL_MODE
Parameter governing the use of SSL. The allowed values arerequire,verify-ca,verify-full, ordisable(allowandpreferare not implemented) If not set, thesslproperty may be checked to enable SSL mode.
-
SSL_FACTORY
public static final PGProperty SSL_FACTORY
Classname of the SSL Factory to use (instance ofjavax.net.ssl.SSLSocketFactory).
-
SSL_FACTORY_ARG
public static final PGProperty SSL_FACTORY_ARG
The String argument to give to the constructor of the SSL Factory
-
SSL_HOSTNAME_VERIFIER
public static final PGProperty SSL_HOSTNAME_VERIFIER
Classname of the SSL HostnameVerifier to use (instance ofjavax.net.ssl.HostnameVerifier).
-
SSL_CERT
public static final PGProperty SSL_CERT
File containing the SSL Certificate. Default will be the filepostgresql.crtin$HOME/.postgresql(*nix) or%APPDATA%\postgresql(windows).
-
SSL_KEY
public static final PGProperty SSL_KEY
File containing the SSL Key. Default will be the filepostgresql.pk8in$HOME/.postgresql(*nix) or%APPDATA%\postgresql(windows).
-
SSL_ROOT_CERT
public static final PGProperty SSL_ROOT_CERT
File containing the root certificate when validating server (sslmode=verify-caorverify-full). Default will be the fileroot.crtin$HOME/.postgresql(*nix) or%APPDATA%\postgresql(windows).
-
SSL_PASSWORD
public static final PGProperty SSL_PASSWORD
The SSL password to use in the default CallbackHandler.
-
SSL_PASSWORD_CALLBACK
public static final PGProperty SSL_PASSWORD_CALLBACK
The classname instantiatingjavax.security.auth.callback.CallbackHandlerto use
-
TCP_KEEP_ALIVE
public static final PGProperty TCP_KEEP_ALIVE
Enable or disable TCP keep-alive. The default isfalse.
-
LOGIN_TIMEOUT
public static final PGProperty LOGIN_TIMEOUT
Specify how long to wait for establishment of a database connection. The timeout is specified in seconds.
-
CONNECT_TIMEOUT
public static final PGProperty CONNECT_TIMEOUT
The timeout value used for socket connect operations. If connecting to the server takes longer than this value, the connection is broken.The timeout is specified in seconds and a value of zero means that it is disabled.
-
SOCKET_TIMEOUT
public static final PGProperty SOCKET_TIMEOUT
The timeout value used for socket read operations. If reading from the server takes longer than this value, the connection is closed. This can be used as both a brute force global query timeout and a method of detecting network problems. The timeout is specified in seconds and a value of zero means that it is disabled.
-
RECEIVE_BUFFER_SIZE
public static final PGProperty RECEIVE_BUFFER_SIZE
Socket read buffer size (SO_RECVBUF). A value of-1, which is the default, means system default.
-
SEND_BUFFER_SIZE
public static final PGProperty SEND_BUFFER_SIZE
Socket write buffer size (SO_SNDBUF). A value of-1, which is the default, means system default.
-
ASSUME_MIN_SERVER_VERSION
public static final PGProperty ASSUME_MIN_SERVER_VERSION
Assume the server is at least that version
-
APPLICATION_NAME
public static final PGProperty APPLICATION_NAME
The application name (require server version >= 9.0)
-
JAAS_APPLICATION_NAME
public static final PGProperty JAAS_APPLICATION_NAME
Specifies the name of the JAAS system or application login configuration.
-
KERBEROS_SERVER_NAME
public static final PGProperty KERBEROS_SERVER_NAME
The Kerberos service name to use when authenticating with GSSAPI. This is equivalent to libpq's PGKRBSRVNAME environment variable.
-
USE_SPNEGO
public static final PGProperty USE_SPNEGO
Use SPNEGO in SSPI authentication requests
-
GSS_LIB
public static final PGProperty GSS_LIB
Force one of- SSPI (Windows transparent single-sign-on)
- GSSAPI (Kerberos, via JSSE)
-
SSPI_SERVICE_CLASS
public static final PGProperty SSPI_SERVICE_CLASS
Specifies the name of the SSPI service class that forms the service class part of the SPN. The default,POSTGRES, is almost always correct.
-
CHARSET
public static final PGProperty CHARSET
The character set to use for data sent to the database or received from the database. This property is only relevant for server versions less than or equal to 7.2.
-
ALLOW_ENCODING_CHANGES
public static final PGProperty ALLOW_ENCODING_CHANGES
When using the V3 protocol the driver monitors changes in certain server configuration parameters that should not be touched by end users. Theclient_encodingsetting is set by the driver and should not be altered. If the driver detects a change it will abort the connection.
-
CURRENT_SCHEMA
public static final PGProperty CURRENT_SCHEMA
Specify the schema to be set in the search-path. This schema will be used to resolve unqualified object names used in statements over this connection.
-
TARGET_SERVER_TYPE
public static final PGProperty TARGET_SERVER_TYPE
-
LOAD_BALANCE_HOSTS
public static final PGProperty LOAD_BALANCE_HOSTS
-
HOST_RECHECK_SECONDS
public static final PGProperty HOST_RECHECK_SECONDS
-
-
Method Detail
-
values
public static PGProperty[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PGProperty c : PGProperty.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PGProperty valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getName
public java.lang.String getName()
Returns the name of the connection parameter. The name is the key that must be used in JDBC URL or in Driver properties- Returns:
- the name of the connection parameter
-
getDefaultValue
public java.lang.String getDefaultValue()
Returns the default value for this connection parameter- Returns:
- the default value for this connection parameter or null
-
getChoices
public java.lang.String[] getChoices()
Returns the available values for this connection parameter- Returns:
- the available values for this connection parameter or null
-
get
public java.lang.String get(java.util.Properties properties)
Returns the value of the connection parameters according to the givenPropertiesor the default value- Parameters:
properties- properties to take actual value from- Returns:
- evaluated value for this connection parameter
-
set
public void set(java.util.Properties properties, java.lang.String value)Set the value for this connection parameter in the givenProperties- Parameters:
properties- properties in which the value should be setvalue- value for this connection parameter
-
getBoolean
public boolean getBoolean(java.util.Properties properties)
Return the boolean value for this connection parameter in the givenProperties- Parameters:
properties- properties to take actual value from- Returns:
- evaluated value for this connection parameter converted to boolean
-
getIntNoCheck
public int getIntNoCheck(java.util.Properties properties)
Return the int value for this connection parameter in the givenProperties. Prefer the use ofgetInt(Properties)anywhere you can throw anSQLException- Parameters:
properties- properties to take actual value from- Returns:
- evaluated value for this connection parameter converted to int
- Throws:
java.lang.NumberFormatException- if it cannot be converted to int.
-
getInt
public int getInt(java.util.Properties properties) throws org.postgresql.util.PSQLExceptionReturn the int value for this connection parameter in the givenProperties- Parameters:
properties- properties to take actual value from- Returns:
- evaluated value for this connection parameter converted to int
- Throws:
org.postgresql.util.PSQLException- if it cannot be converted to int.
-
getInteger
public java.lang.Integer getInteger(java.util.Properties properties) throws org.postgresql.util.PSQLExceptionReturn theIntegervalue for this connection parameter in the givenProperties- Parameters:
properties- properties to take actual value from- Returns:
- evaluated value for this connection parameter converted to Integer or null
- Throws:
org.postgresql.util.PSQLException
-
set
public void set(java.util.Properties properties, boolean value)Set the boolean value for this connection parameter in the givenProperties- Parameters:
properties- properties in which the value should be setvalue- boolean value for this connection parameter
-
set
public void set(java.util.Properties properties, int value)Set the int value for this connection parameter in the givenProperties- Parameters:
properties- properties in which the value should be setvalue- int value for this connection parameter
-
isPresent
public boolean isPresent(java.util.Properties properties)
Test whether this property is present in the givenProperties- Returns:
- true if the parameter is specified in the given properties
-
toDriverPropertyInfo
public java.sql.DriverPropertyInfo toDriverPropertyInfo(java.util.Properties properties)
Convert this connection parameter and the value read from the givenPropertiesinto aDriverPropertyInfo- Parameters:
properties- properties to take actual value from- Returns:
- a DriverPropertyInfo representing this connection parameter
-
forName
public static PGProperty forName(java.lang.String name)
-
-