JDBC Connection Properties

You use connection properties to configure the connection between your JDBC client application and your Vertica database. The properties provide the basic information about the connections, such as the server name and port number to use to connect to your database. They also let you tune the performance of your connection and enable logging.

You can set a connection property in one of the following ways:

  • Include the property name and value as part of the connection string you pass to the method DriverManager.getConnection().
  • Set the properties in a Properties object, and then pass it to the method DriverManager.getConnection().
  • Use the method VerticaConnection.setProperty(). With this approach, you can change only those connection properties that remain changeable after the connection has been established.

Also, some standard JDBC connection properties have getters and setters on the Connection interface, such as Connection.setAutoCommit().

Connection Properties

The properties in the following table can only be set before you open the connection to the database. Two of them are required for every connection.

Property Description

BinaryTransfer

Boolean value that determines which mode Vertica uses when connecting to a JDBC client:

  • true: binary transfer (default)
  • false: text transfer

Binary transfer is generally more efficient at reading data from a server to a JDBC client and typically requires less bandwidth than text transfer. However, when transferring a large number of small values, binary transfer may use more bandwidth.

The data output by both modes is identical with the following exceptions for certain data types:

  • FLOAT: Binary transfer has slightly better precision.
  • TIMESTAMPTZ: Binary transfer can fail to get the session time zone and default to the local time zone, while text transfer reliably uses the session time zone.
  • NUMERIC: Binary transfer is forcibly disabled for NUMERIC data by the server for Vertica 11.0.2+.

ConnSettings

A string containing SQL statements that the JDBC driver automatically runs after it connects to the database. You can use this property to set the locale or schema search path, or perform other configuration that the connection requires.

DisableCopyLocal

When set to true, disables file-based COPY LOCAL operations, including copying data from local files and using local files to store data and exceptions. You can use this property to prevent users from writing to and copying from files on a Vertica host, including an MC host.

Default: false

Label

Sets a label for the connection on the server. This value appears in the client_label column of the SESSIONS system table.

Default: jdbc-driver‑version-random_number

SSL

When set to true, use SSL to encrypt the connection to the server. Vertica must be configured to handle SSL connections before you can establish an SSL-encrypted connection to it. See TLS Protocol in the Administrator's Guide. This property has been deprecated in favor of the TLSmode property.

Default: false

TLSmode

TLSmode identifies the security level that Vertica applies to the JDBC connection. Vertica must be configured to handle TLS connections before you can establish an encrypted connection to it. See TLS Protocol for details. Valid values are:

  • disable: JDBC connects using plain text and implements no security measures.
  • require: JDBC connects using TLS without verifying the CA certificate.
  • verify-ca: JDBC connects using TLS and confirms that the server certificate has been signed by the certificate authority. This setting is equivalent to the deprecated ssl=true property.
  • verify-full: JDBC connects using TLS, confirms that the server certificate has been signed by the certificate authority, and verifies that the host name matches the name provided in the server certificate.

If this property and the SSL property are set, this property takes precedence.

Default: disable

HostnameVerifier

If TLSmode is set to verify-full, this property the fully qualified domain name of the verifier that you want to confirm the host name.

Password

Required, the password to use to log into the database.

User

Required, the database user name to use to connect to the database.

ConnectionLoadBalance

A Boolean value indicating whether the client is willing to have its connection redirected to another host in the Vertica database. This setting has an effect only if the server has also enabled connection load balancing. See About Native Connection Load Balancing in the Administrator's Guide for more information about native connection load balancing.

Default: false

BackupServerNode

A string containing the host name or IP address of one or more hosts in the database. If the connection to the host specified in the connection string times out, the client attempts to connect to any host named in this string.The host name or IP address can also include a colon followed by the port number for the database. If no port number is specified, the client uses the standard port number (5433) . Separate multiple host name or IP address entries with commas.

PreferredAddressFamily

The IP version to use if the client and server have both IPv4 and IPv6 addresses and you have provided a host name, one of the following:

  • ipv4: Connect to the server using IPv4.
  • ipv6: Connect to the server using IPv6.
  • none: Use the IP address provided by the DNS server.

Default: none

KeyStorePath

The server path to a .JKS file containing your private keys and their corresponding certificate chains. For information on creating a keystore, refer to documentation for your development environment. For information on creating a keystore, refer to the Java documentation.

KeyStorePassword

The password protecting the keystore file. If individual keys are also encrypted, the keystore file password must match the password for a key within the keystore.

TrustStorePath

The local path to a .JKS truststore file containing certificates from authorities you trust.

TrustStorePassword

The password protecting the truststore file.

Timeout Properties

With the following parameters, you can specify various timeouts for each step and the overall connection of JDBC to your Vertica database.

Property Description

LoginTimeout

The number of seconds Vertica waits for the client to log in to the database before throwing a SQLException.

Default: 0 (no timeout)

LoginNodeTimeout

The number of seconds the JDBC client waits before attempting to connect to the next node if the Vertica process is running, but does not respond. The "next" node is determined by the either the BackupServerNode connection property or DNS resolution. If you only provide a single IP address, the JDBC client returns an error.

A timeout value of 0 instructs JDBC to wait indefinitely for an error/a successful connection rather than attempt to connect to another node.

Default: 0 (no timeout)

LoginNetworkTimeout

The number of seconds the JDBC client has to establish a TCP connection to a Vertica node. A typical use case for this property is to let JDBC connect to another node if the system is down for maintenance and modifying the JDBC application's connection string is infeasible.

Default: 0 (no timeout)

NetworkTimeout

The number of milliseconds for the server to reply to a request after the client has established a connection with the database.

Default: 0

The relationship between these properties and the role they play when JDBC attempts to connect to a Vertica database is illustrated in the following diagram:

A diagram how the timeouts behave when JDBC attempts to connect to a primary node and two backup nodes

General Properties

The following properties can be set after the connection is established. None of these properties are required.

Property Description

AutoCommit

Controls whether the connection automatically commits transactions. Set this parameter to false to prevent the connection from automatically committing its transactions. You often want to do this when you are bulk loading multiple batches of data and you want the ability to roll back all of the loads if an error occurs.

Set After Connection: Connection.setAutoCommit()

Default: true

DirectBatchInsert

Deprecated, always set to true.

MultipleActiveResultSets

Allows more than one active result set on a single connection via MultipleActiveResultSets (MARS).

If both MultipleActiveResultSets and ResultBufferSize are turned on, MultipleActiveResultSets takes precedence. The connection does not provide an error, however ResultBufferSize is ignored.

Set After Connection: VerticaConnection.setProperty()

Default: false

ReadOnly

When set to true, makes the data connection read-only. Any queries attempting to update the database using a read-only connection cause a SQLException.

Set After Connection: Connection.setReadOnly()

Default: false

ResultBufferSize

Sets the size of the buffer the Vertica JDBC driver uses to temporarily store result sets. A value of 0 means ResultBufferSize is turned off.

Note: This property was named maxLRSMemory in previous versions of the Vertica JDBC driver.

Set After Connection: VerticaConnection.setProperty()

Default: 8912 (8KB)

SearchPath

Sets the schema search path for the connection. This value is a string containing a comma-separated list of schema names. See Setting Search Paths in the Administrator's Guide for more information on the schema search path.

Set After Connection: VerticaConnection.setProperty()

Default: "$user", public, v_catalog, v_monitor, v_internal

ThreePartNaming

A Boolean value that controls how DatabaseMetaData reports the catalog name. When set to true, the database name is returned as the catalog name in the database metadata. When set to false, NULL is returned as the catalog name.

Enable this option if your client software is set up to get the catalog name from the database metadata for use in a three-part name reference.

Set After Connection: VerticaConnection.setProperty()

Default: true

TransactionIsolation

Sets the isolation level of the transactions that use the connection. See Changing the Transaction Isolation Level for details.

Note: In previous versions of the Vertica JDBC driver, this property was only available using a getter and setter on the PGConnection object. You can now set it in the same way as other connection properties.

Set After Connection: Connection.setTransactionIsolation()

Default: TRANSACTION_READ_COMMITTED

Logging Properties

The properties that control client logging must be set before the connection is opened. None of these properties are required, and none can be changed after the Connection object has been instantiated.

Property Description

LogLevel

Sets the type of information logged by the JDBC driver. The value is set to one of the following values:

  • "DEBUG"
  • "ERROR"
  • "TRACE"
  • "WARNING"
  • "INFO"
  • "OFF"

Default: "OFF"

LogNameSpace

Restricts logging to just messages generated by a specific packages. Valid values are:

  • com.vertica — All messages generated by the JDBC driver
  • com.vertica.jdbc — All messages generated by the top-level JDBC API
  • com.vertica.jdbc.kv — A ll messages generated by the JDBC KV API)
  • com.vertica.jdbc.core — Connection and statement settings
  • com.vertica.jdbc.io — Client/server protocol messages
  • com.vertica.jdbc.util — Miscellaneous utilities
  • com.vertica.jdbc.dataengine — Query execution and result set iteration
  • com.vertica.dataengine — Query execution and result set iteration

LogPath

Sets the path where the log file is written.

Default: The current working directory

Kerberos Connection Parameters

Use the following parameters to set the service and host name principals for client authentication using Kerberos.

Parameters Description
JAASConfigName

Provides the name of the JAAS configuration that contains the JAAS Krb5LoginModule and its settings

Default: verticajdbc

KerberosServiceName

Provides the service name portion of the Vertica Kerberos principal, for example: vertica/host@EXAMPLE.COM

Default: vertica

KerberosHostname

Provides the instance or host name portion of theVertica Kerberos principal, for example: vertica/host@EXAMPLE.COM

Default: Value specified in the servername connection string property

Routable Connection API Connection Parameters

Use the following parameters to set properties to enable and configure the connection for Routable Connection lookups.

Parameters Description
EnableRoutableQueries

Enables Routable Connection lookup. See Routing JDBC Queries Directly to a Single Node

Default: false

FailOnMultiNodePlans

If the query plan requires more than one node, then the query fails. Only applicable when EnableRoutableQueries = true.

Default: true

MetadataCacheLifetime

The time in seconds to keep projection metadata. Only applicable when EnableRoutableQueries = true.

Default:

MaxPooledConnections

Cluster-wide maximum number of connections to keep in the VerticaRoutableConnection’s internal pool. Only applicable when EnableRoutableQueries = true.

Default: 20

MaxPooledConnections
PerNode

Per-node maximum number of connections to keep in the VerticaRoutableConnection’s internal pool. Only applicable when EnableRoutableQueries = true.

Default: 5

You can also use VerticaConnection.setProperty() method to set properties that have standard JDBC Connection setters, such as AutoCommit.

For information about manipulating these attributes, see Setting and Getting Connection Property Values.