This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

ODBC client driver

The Vertica ODBC client driver provides an interface for creating client applications with several languages:.

The Vertica ODBC client driver provides an interface for creating client applications with several languages:

To install ODBC, see Installing the ODBC client driver.

1 - Installing the ODBC client driver

To install ODBC, follow the instructions according to your platform.

To install ODBC, follow the instructions according to your platform. For a list of supported platforms, see Client drivers support.

This page covers a non-FIPS installation. To install ODBC on a FIPS-compliant system, see Installing the FIPS client driver for ODBC and vsql.

Installing on Linux

Installing Vertica from the RPM automatically installs the ODBC client driver, so you do not need to install them again on the machine running Vertica. To use the ODBC client driver in this case, create a DSN.

To install the ODBC client driver manually on other machines:

  1. Log in to the client system as root.

  2. Verify that your system has a supported ODBC driver manager.

  3. Download the ODBC client driver for Linux in the format appropriate for your distribution.

  4. Install or extract the driver:

    • If you downloaded the .rpm, install the driver:

      $ rpm -Uvh driver_name.rpm
      
    • If you downloaded the .tar, create the /opt/vertica/ directory if it does not already exist, copy the .tar to it, navigate to it, and extract the .tar:

      
      $ mkdir -p /opt/vertica/
      $ cp driver_name.tar.gz /opt/vertica/
      $ tar vzxf driver_name.tar.gz
      

      This creates two directories:

      • /opt/vertica/include: Contains the header file.

      • /opt/vertica/lib64/ (64-bit) or /opt/vertica/lib/ (32-bit): Contains library files.

  5. Set the following ODBC driver settings in vertica.ini. For details on each, see ODBC driver settings:

    • ErrorMessagesPath: Required, the path of the directory containing the ODBC driver's error message files.

    • ODBCInstLib: The path to the ODBC installer library. This is only required if the driver manager's installation library is not in the environment variables LD_LIBRARY_PATH or LIB_PATH.

    • DriverManagerEncoding: The UTF encoding standard used by the driver manager. This is only required if your driver manager does not use UTF-8.

    The following is an example configuration in vertica.ini:

    • Use encoding for the 64-bit UNIXODBC driver manager.

    • Use the error messages defined in the standard Vertica 64-bit ODBC driver installation directory.

    • Log all warnings and more severe messages to log files in /tmp/

      [Driver]
      DriverManagerEncoding=UTF-16
      ODBCInstLib=/usr/lib64/libodbcinst.so
      ErrorMessagesPath=/opt/vertica
      LogLevel=4
      LogPath=/tmp
      
  6. Create a DSN.

Installing on macOS

To install the ODBC client driver on macOS:

  1. Verify that your system has a compatible driver manager. The driver is designed to be used with the standard iODBC Driver Manager that ships with macOS. You can also use unixODBC.

  2. Download the ODBC client driver.

  3. If you installed a previous version of the ODBC driver, your system might already have a registered driver named "Vertica". You must remove or rename this older version of the driver before installing a new version from the .pkg installer. Renaming the older version allows you to retain the old version after you install the new one.

  4. Run the installer.

  5. Create a DSN.

Installing silently

  1. Log into the client macOS in one of two ways:

    • As an administrator account if you are installing the driver for system-wide use.

    • As the user who needs to use the Vertica ODBC driver.

  2. Open a terminal.

  3. Install the .pkg file containing the ODBC driver using the command:

    sudo installer -pkg path/to/client/driver/vertica-odbc-xx.x.x-x.pkg -target /
    

Installing on Windows

To install the ODBC client driver on Windows:

  1. Download the client driver installer for Windows.

  2. Run the installer.

  3. Create a DSN.

Installing silently

  1. Open a terminal as an Administrator.

  2. Run the following command to silently install the drivers to C:\Program Files\Vertica Systems:

    VerticaSetup.exe -q -install InstallFolder="C:\Program Files\Vertica Systems"
    

2 - Upgrading and downgrading ODBC

To upgrade ODBC:.

Linux

To upgrade ODBC:

  1. Uninstall the current version of the driver.

  2. Install the new version of the driver.

macOS

To upgrade or downgrade ODBC:

  • Upgrade: Newly installed versions of the Vertica ODBC driver for macOS automatically upgrade the relevant driver system settings. Any DSNs associated with a previous version of the driver are not affected, except that they begin using the newer version of the driver.

  • Downgrade: Run the uninstall script to remove the current version of the Vertica ODBC driver for macOS. Complete this step before installing an older driver version.

Windows

  1. Download the Windows client driver installer.

  2. Run the installer and follow the prompts to upgrade the driver. The installer upgrades existing drivers in place.

  3. Reboot your system.

3 - Uninstalling ODBC

If you installed ODBC with the .rpm:.

Linux

If you installed ODBC with the .rpm:

$ rpm -e package_name

If you installed ODBC with the .tar, delete the directory manually.

macOS

Uninstalling the macOS ODBC Client-Driver does not remove any existing DSNs associated with the driver.

To uninstall:

  1. Open a terminal window.

  2. Run the command:

    sudo /Library/Vertica/ODBC/bin/Uninstall
    

Windows

  1. Open the Add or Remove Programs menu.

  2. EIther uninstall the Vertica Client Installer to remove all client drivers from the system or, to only uninstall ODBC, uninstall the following applications:

    • Vertica ODBC Driver (32 Bit)

    • Vertica ODBC Driver (64 Bit)

4 - Creating an ODBC data source name (DSN)

A Data Source Name (DSN) is the logical name that is used by Open Database Connectivity (ODBC) to refer to the driver and other information that is required to access data from a data source.

A Data Source Name (DSN) is the logical name that is used by Open Database Connectivity (ODBC) to refer to the driver and other information that is required to access data from a data source. Whether you are developing your own ODBC client code or you are using a third-party tool that needs to access Vertica using ODBC, you need to configure and test a DSN. The method you use depends upon the client operating system you are using.

Refer to the following sections for information specific to your client operating system.

4.1 - Creating an ODBC DSN for Linux

You define DSN on Linux and other UNIX-like platforms in a text file.

You define DSN on Linux and other UNIX-like platforms in a text file. Your client's driver manager reads this file to determine how to connect to your Vertica database. The driver manager usually looks for the DSN definitions in two places:

  • /etc/odbc.ini

  • ~/.odbc.ini (a file named .odbc.ini in the user's home directory)

Users must be able to read the odbc.ini file in order to use it to connect to the database. If you use a global odbc.ini file, consider creating a UNIX group with read access to the file. Then, add the users who need to use the DSN to this group.

The structure of these files is the same—only their location differs. If both files are present, the ~/.odbc.ini file usually overrides the system-wide /etc/odbc.ini file.

odbc.ini file structure

The odbc.ini is a text file that contains two types of lines:

  • Section definitions, which are text strings enclosed in square brackets.

  • Parameter definitions, which contain a parameter name, an equals sign (=), and then the parameter's value.

The first section of the file is always named [ODBC Data Sources], and contains a list of all the DSNs that the odbc.ini file defines. The parameters in this section are the names of the DSNs, which appear as section definitions later in the file. The value is a text description of the DSN and has no function. For example, an odbc.ini file that defines a single DSN named Vertica DSN could have this ODBC Data Sources section:

[ODBC Data Sources]
VerticaDSN = "vmartdb"

Appearing after the ODBC data sources section are sections that define each DSN. The name of a DSN section must match one of the names defined in the ODBC Data Sources section.

Configuring the odbc.ini file:

To create or edit the DSN definition file:

  1. Using the text editor of your choice, open odbc.ini or ~/.odbc.ini.

  2. Create an ODBC Data Sources section and define a parameter:

    • Whose name is the name of the DSN you want to create

    • Whose value is a description of the DSN

    For example, to create a DSN named VMart, you would enter:

    [ODBC Data Sources]
    VMart = "VMart database on Vertica"
    
  3. Create a section whose name matches the DSN name you defined in step 2. In this section, you add parameters that define the DSN's settings. The most commonly-defined parameters are:

    • Description – Additional information about the data source.

    • Driver – The location and designation of the Vertica ODBC driver, or the name of a driver defined in the odbcinst.ini file (see below). For future compatibility, use the name of the symbolic link in the library directory, rather than the library file:

      • ( /opt/vertica/lib, on 32-bit clients

      • /opt/vertica/lib64, on 64-bit clients

      For example, the symbolic link for the 64-bit ODBC driver library is:

      /opt/vertica/lib64/libverticaodbc.so
      

      The symbolic link always points to the most up-to-date version of the Vertica client ODBC library. Use this link so that you do not need to update all of your DSNs when you update your client drivers.

    • Database – The name of the database running on the server. This example uses vmartdb for the vmartdb.

    • ServerName — The name of the server where Vertica is installed. Use localhost if Vertica is installed on the same machine.

      You can provide an IPv4 address, IPv6 address, or host name.

      In mixed IPv4/IPv6 networks, the DNS server configuration determines which IP version address is sent first. Use the PreferredAddressFamily option to force the connection to use either IPv4 or IPv6.

    • UID — Either the database superuser (same name as database administrator account) or a user that the superuser has created and granted privileges. This example uses the user name dbadmin.

    • PWD —The password for the specified user name. This example leaves the password field blank.

    • Port — The port number on which Vertica listens for ODBC connections. For example, 5433.

    • ConnSettings — Can contain SQL commands separated by a semicolon. These commands can be run immediately after connecting to the server.

    • SSLKeyFile — The file path and name of the client's private key. This file can reside anywhere on the system.

    • SSLCertFile —The file path and name of the client's public certificate. This file can reside anywhere on the system.

    • Locale — The default locale used for the session. By default, the locale for the database is: en_US@collation=binary (English as in the United States of America). Specify the locale as an ICU Locale. See the ICU User Guide (http://userguide.icu-project.org/locale) for a complete list of parameters that can be used to specify a locale.

    • 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.

For example:

[VMart]
Description = Vmart Database
Driver = /opt/vertica/lib64/libverticaodbc.so
Database = vmartdb
Servername = host01
UID = dbadmin
PWD =
Port = 5433
ConnSettings =
AutoCommit = 0
SSLKeyFile = /home/dbadmin/client.key
SSLCertFile = /home/dbadmin/client.crt
Locale = en_US@collation=binary

See ODBC DSN connection properties for a complete list of parameters including Vertica-specific ones.

Using an odbcinst.ini file

Instead of giving the path of the ODBC driver library in your DSN definitions, you can use the name of a driver defined in the odbcinst.ini file. This method is useful method if you have many DSNs and often need to update them to point to new driver libraries. It also allows you to set some additional ODBC parameters, such as the threading model.

Just as in the odbc.ini file, odbcinst.ini has sections. Each section defines an ODBC driver that can be referenced in the odbc.ini files.

In a section, you can define the following parameters:

  • Description— Additional information about the data source.

  • Driver— The location and designation of the Vertica ODBC driver, such as /opt/vertica/lib64/libverticaodbc.so

For example:

[Vertica]
Description = Vertica ODBC Driver
Driver = /opt/vertica/lib64/libverticaodbc.so

Then, in your odbc.ini file, use the name of the section you created in the odbcinst.ini file that describes the driver you want to use. For example:

[VMart]
Description = Vertica Vmart database
Driver = Vertica

If you are using the unixODBC driver manager, you should also add an ODBC section to override its standard threading settings. By default, unixODBC serializes all SQL calls through ODBC, which prevents multiple parallel loads. To change this default behavior, add the following to your odbcinst.ini file:

[ODBC]
Threading = 1

Configuring additional ODBC settings

On Linux and UNIX systems, you need to configure some additional driver settings before you can use your DSN. See ODBC driver settings for details.

4.1.1 - Testing an ODBC DSN using isql

The unixODBC driver manager includes a utility named isql, which is a simple ODBC command-line client.

The unixODBC driver manager includes a utility named isql, which is a simple ODBC command-line client. It lets you to connect to a DSN to send commands and receive results, similarly to vsql.

To use isql to test a DSN connection:

  1. Run the following command:

    $ isql –v DSNname
    

    Where DSNname is the name of the DSN you created.

    A connection message and a SQL prompt display. If they do not, you could have a configuration problem or you could be using the wrong user name or password.

  2. Try a simple SQL statement. For example:

    SQL> SELECT table_name FROM tables;
    

    The isql tool returns the results of your SQL statement.

4.2 - Creating an ODBC DSN for windows clients

To create a DSN for Microsoft Windows clients, you must perform the following tasks:.

To create a DSN for Microsoft Windows clients, you must perform the following tasks:

4.2.1 - Setting up an ODBC DSN

A Data Source Name (DSN) is the ODBC logical name for the drive and other information the database needs to access data.

A Data Source Name (DSN) is the ODBC logical name for the drive and other information the database needs to access data. The name is used by Internet Information Services (IIS) for a connection to an ODBC data source.

This section describes how to use the Vertica ODBC Driver to set up an ODBC DSN. This topic assumes that the driver is already installed, as described in Installing Client Drivers on Windows.

To set up a DSN

  1. Open the ODBC Administrator. For example, you could navigate to Start > Control Panel > Administrative Tools > Data Sources (ODBC).

  2. Decide if you want all users on your client system to be able to access to the DSN for the Vertica database.

    • If you want all users to have access, then click the System DSN tab.

    • Otherwise, click the User DSN tab to create a DSN that is only usable by your Windows user account.

  3. Click Add to create a new DSN to connect to the Vertica database.

  4. Scroll through the list of drivers in the Create a New Data Source dialog box to locate the Vertica driver. Select the driver, and then click Finish.

    The Vertica ODBC DSN configuration dialog box appears.

  5. Click the More >>> button to view a description of the field you are editing and the connection string defined by the DSN.

  6. Enter the information for your DSN. The following fields are required:

    • DSN Name — The name for the DSN. Clients use this name to identify the DSN to which they want to connect. The DSN name must satisfy the following requirements:

      • Its maximum length is 32 characters.

      • It is composed of ASCII characters except for the following: { } , ; ? * = ! @ \

      • It contains no spaces.

    • Server — The host name or IP address of the Vertica server to which you want to connect. Use localhost, if Vertica is installed on the same machine.

      You can provide an IPv4 address, IPv6 address, or host name.

      In mixed IPv4/IPv6 networks, the DNS server configuration determines which IP version address is sent first. Use the PreferredAddressFamily option to force the connection to use either IPv4 or IPv6.

      The PreferredAddressFamily option is available on the Client Settings tab.

    • Backup Servers — A comma-separated list of host names or IP addresses used to connect to if the server specified by the Server field is down. Optional.

    • Database —The name of the Vertica database.

    • User Name — The name of the user account to use when connecting to the database. If the application does not supply its own user name when connecting to the DSN, this account name is used to log into the database.

    The rest of the fields are optional. See DSN Parameters for detailed information about the DSN parameters you can define.

  7. If you want to test your connection:

    1. Enter at least a valid DSN name, Server name, Database, and either User name or select Windows authentication.

    2. If you have not selected Windows authentication, you can enter a password in the Password box. Alternately, you can select Password for missing password to have the driver prompt you for a password when connecting.

    3. Click Test Connection.

  8. When you have finished editing and testing the DSN, click OK. The Vertica ODBC DSN configuration window closes, and your new DSN is listed in the ODBC Data Source Administrator window.

  9. Click OK to close the ODBC Data Source Administrator.

After creating the DSN, you can test it using Microsoft Excel 2007.

Setting up a 32-Bit DSN on 64-Bit versions of Microsoft windows

On 64-bit versions of Windows, the default ODBC Data Source Administrator creates and edits DSNs that are associated with the 64-bit Vertica ODBC library.

Attempting to use these 64-bit DSNs with a 32-bit client application results in an architecture mismatch error. Instead, you must create a specific 32-bit DSN for 32-bit clients by running the 32-bit ODBC Administrator usually located at:

c:\Windows\SysWOW64\odbcad32.exe

This administrator window edits a set of DSNs that are associated with the 32-bit ODBC library. You can then use your 32-bit client applications with the DSNs you create with this version of the ODBC administrator.

4.2.2 - Encrypting passwords on ODBC DSN

When you install an ODBC driver and create a Data Source Name (DSN) the DSN settings are stored in the registry, including the password.

When you install an ODBC driver and create a Data Source Name (DSN) the DSN settings are stored in the registry, including the password. Encrypting passwords on ODBC DSN applies only to Windows systems.

Encrypting passwords on an ODBC data source name (DSN) provides security against unauthorized database access. The password is not encrypted by default and is stored in plain-text.

Enable password encryption

Use the EncryptPassword parameter to enable or disable password encryption for an ODBC DSN:

  • EncryptPassword = true enables password encryption

  • EncryptPassword = false (default) disables password encryption

Set EncryptPassword in the Windows registry - HKEY_LOCAL_MACHINE > Software > Vertica > ODBC > Driver EncryptPassword=<true/false>.

Encrypted passwords get updated in the following registry locations:

For a user DSN:

HKEY_CURRENT_USER-> Software -> ODBC -> ODBC.INI -> DSNNAME -> PWD

For a system DSN:

HKEY_LOCAL_MACHINE-> Software -> ODBC -> ODBC.INI -> DSNNAME -> PWD

Verify password encryption

Use Windows Registry editor to determine if password encryption is enabled based on the value of EncryptPassword. Depending on the type of DSN you installed, check the following:

For a user DSN: HKEY_CURRENT_USER > Software > ODBC > ODBC.INI > dsn name > isPasswordEncrypted=<1/0>

For a system DSN: HKEY_LOCAL_MACHINE > Software > ODBC > ODBC.INI > dsn name > isPasswordEncrypted=<1/0>

For each DSN, the value of the isPasswordEncrypted parameter indicates the status of the password encryption, where 1 indicates an encrypted password and 0 indicates an unencrypted password.

4.2.3 - Testing an ODBC DSN using Excel

You can use Microsoft Excel to verify that an application can connect to an ODBC data source or other ODBC application.

You can use Microsoft Excel to verify that an application can connect to an ODBC data source or other ODBC application.

  1. Open Microsoft Excel, and select Data > Get External Data > From Other Sources > From Microsoft Query.

  2. When the Choose Data Source dialog box opens:

    1. Select New Data Source, and click OK.

    2. Enter the name of the data source.

    3. Select the Vertica driver.

    4. Click Connect.

  3. When the Vertica Connection Dialog box opens, enter the connection information for the DSN, and click OK.

  4. Click OK on the Create New Data Source dialog box to return to the Choose Data Source dialog box.

  5. Select VMart_Schema*, and verify that the Use the Query Wizard check box is deselected. Click OK.

  6. When the Add Tables dialog box opens, click Close.

  7. When the Microsoft Query window opens, click the SQL button.

  8. In the SQL window, write any simple query to test your connection. For example:

    SELECT DISTINCT calendar_year FROM date_dimension;
    
  9. * If you see the caution, "SQL Query can't be represented graphically. Continue anyway?" click **OK**.      * The data values 2003, 2004, 2005, 2006, 2007 indicate that you successfully connected to and ran a query through ODBC.
    
  10. Select File > Return Data to Microsoft Office Excel.

  11. In the Import Data dialog box, click OK.

    The data is now available for use in an Excel worksheet.

4.3 - Creating an ODBC DSN for macOS clients

You can use the Vertica ODBC Driver to set up an ODBC DSN.

You can use the Vertica ODBC Driver to set up an ODBC DSN. This procedure assumes that the driver is already installed, as described in Installing the ODBC client driver.

Setting up a DSN

  1. Using your web browser, download and install the Apple ODBC Administrator Tool.

  2. Locate and open the ODBC Administrator Tool after installation:

    1. Navigate to Finder > Applications > Utilities.

    2. Open the ODBC Administrator Tool.

  3. Click the Drivers tab, and verify that the Vertica driver is installed.

  4. Specify if you want all users on your client system to be able to access the DSN for the Vertica database:

    • If you want all users to have access, then click the System DSN tab.

    • Otherwise, click the User DSN tab to create a DSN that is only usable by your Macintosh user account.

  5. Click Add... to create a new DSN to connect to the Vertica database.

  6. Scroll through the list of drivers in the Choose A Driver dialog box to locate the Vertica driver. Select the driver, and then click OK. A dialog box opens that requests DSN parameter information.

  7. In the dialog box, enter the Data Source Name (DSN) and an optional Description. To do so, click Add to insert keywords (parameters) and values that define the settings needed to connect to your database, including database name, server host, database user name (such as dbadamin), database password, and port. Then, click OK.

  8. In the ODBC Administrator dialog box, click Apply.

    See ODBC DSN connection properties for a complete list of parameters including those specific to Vertica.

After configuring the ODBC Administrator Tool, you may need to configure additional driver settings before you can use your DSN, depending on your environment. See Additional ODBC Driver Configuration Settings for details.

4.3.1 - Testing an ODBC DSN using iodbctest

The standard iODBC Driver Manager on OS X includes a utility named iodbctest that lets you test a DSN to verify that it is correctly configured.

The standard iODBC Driver Manager on OS X includes a utility named iodbctest that lets you test a DSN to verify that it is correctly configured. You pass this command a connection string in the same format that you would use to open an ODBC database connection. After configuring your DSN connection, you can run a query to verify that the connection works.

For example:


# iodbctest "DSN=VerticaDSN;UID=dbadmin;PWD=password"
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0607.1008
Driver: 07.01.0200 (verticaodbcw.so)
SQL> SELECT table_name FROM tables;
table_name
--------------------------------------------------------------------------------------------------------------------------------
customer_dimension
product_dimension
promotion_dimension
date_dimension
vendor_dimension
employee_dimension
shipping_dimension
warehouse_dimension
inventory_fact
store_dimension
store_sales_fact
store_orders_fact
online_page_dimension
call_center_dimension
online_sales_fact
numbers
result set 1 returned 16 rows.

4.4 - ODBC DSN connection properties

The following tables list the connection properties you can set in the DSNs for use with Vertica's ODBC driver.

The following tables list the connection properties you can set in the DSNs for use with Vertica's ODBC driver. To set these parameters, see Setting DSN connection properties.

Required connection properties

These connection properties are the minimum required to create a functioning DSN.

Property Description
Driver The file path and name of the driver used.
Database The name of the database running on the server.
Servername

The host name or IP address of any active node in a Vertica cluster.

You can provide an IPv4 address, IPv6 address, or host name.

In mixed IPv4/IPv6 networks, the DNS server configuration determines which IP version address is sent first. Use the PreferredAddressFamily option to force the connection to use either IPv4 or IPv6.

You can also use the aliases "server" and "host" for this property.

UID The database username.

Optional properties

Property Description
Port

The port number on which Vertica listens for ODBC connections.

Default: 5433

PWD

The password for the specified user name. You may insert an empty string to leave this property blank.

Default: None, login only succeeds if the user does not have a password set.

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

Advanced settings

Property Description
AutoCommit

A Boolean value that controls whether the driver automatically commits transactions after executing a DML statement.

Default: true

BackupServerNode

A string containing the host name or IP address that client libraries can try to connect to if the host specified in ServerName is unreachable. Connection attempts continue until successful or until the list of server nodes is exhausted.

Valid values: Comma-separated list of servers optionally followed by a colon and port number.

ConnectionLoadBalance

A Boolean value that indicates whether the connection can be redirected to a host in the database other than the ServerNode.

This affects the connection only if the load balancing. is set to something other than "none". When the node differs from the node the client is connected to, the client disconnects and reconnects to the targeted node. See About Native Connection Load Balancing in the Administration Guide.

Default: false

ConnSettings

A string containing SQL commands that the driver should execute immediately after connecting to the server. You can use this property to configure the connection, such as setting a schema search path.

Reserved symbol: In the connection string semicolon (;) is a reserved symbol. To set multiple properties as part of ConnSettings properties, use %3B as the comma delimiter, and + (plus) for spaces.

ConnectionTimeout

The number of seconds to wait for a request to complete before returning to the client application. This is equivalent to the SQL_ATTR_CONNECTION_TIMEOUT parameter in the ODBC API.

Default: 0 (no timeout)

ConvertSquareBracketIdentifiers

Controls whether square-bracket query identifiers are converted to a double quote identifier for compatibility when making queries to a Vertica database.

Default: false

DirectBatchInsert Deprecated, always set to true.
DriverStringConversions

Controls whether the ODBC driver performs type conversions on strings sent between the ODBC driver and the database. Possible values are:

  • NONE: No conversion in either direction. This results in the highest performance.

  • INPUT: Strings sent from the client to the server are converted, but strings sent from the server to the client are not.

  • OUTPUT: Strings sent by the server to the client are converted, but strings sent from the client to the server are not.

  • BOTH: Strings are converted in both directions.

Default: OUTPUT

Locale

The locale used for the session. Specify the locale as an ICU Locale.

**See **the ICU User Guide for a complete list of properties that can be used to specify a locale.

Default: en_US@collation=binary

PromptOnNoPassword

[Windows only] Controls whether users are prompted to enter a password, if none is supplied by the connection string or DSN used to connect to Vertica. See Prompting windows users for passwords.

Default: false

ReadOnly

A true or false value that controls whether the connection can read data only from Vertica.

Default: false

ResultBufferSize

Size of memory buffer for the large result sets in streaming mode. A value of 0 means ResultBufferSize is turned off.

Default: 131072 (128KB)

TransactionIsolation

Sets the transaction isolation for the connection, one of the following:

  • Read Committed

  • Serializable

  • Server Default

See Changing Transaction Isolation Levels for an explanation of transaction isolation.

Default: Server Default

Workload

The name of the workload for the session. For details, see Workload routing.

Default: None (no workload)

Identification

Property Description Standard/ Vertica
Description

Description for the DSN entry.

Required? No

Insert an empty string to leave the description empty.

Standard
Label / SessionLabel

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

Label and SessionLabel are synonyms and can be used interchangeably.

Vertica

OAuth connection properties

The following connection properties pertain to OAuth in ODBC.

Property Description
OAuthAccessToken

Required if OAuthRefreshToken is unspecified, an OAuth token that authorizes a user to the database.

Either OAuthAccessToken or OAuthRefreshToken must be set (programmatically or manually) to authenticate to Vertica with OAuth authentication.

You can omit both OAuthAccessToken and OAuthRefreshToken only if you authenticate to your identity provider directly with single sign-on through the client driver, which requires the machine running the ODBC driver to have access to a web browser.

For details on the different methods for retrieving access tokens, see Retrieving access tokens.

OAuthRefreshToken Required if OAuthAccessToken is unspecified, a token that used to obtain a new access token when their old one expires.

Either OAuthAccessToken or OAuthRefreshToken must be set (programmatically or manually) to authenticate to Vertica with OAuth authentication.

You can omit both OAuthAccessToken and OAuthRefreshToken only if you authenticate to your identity provider directly with single sign-on through the client driver, which requires the machine running the ODBC driver to have access to a web browser.

For details on the different methods for retrieving access tokens, see Retrieving access tokens.

If you set this parameter, you must also set the OAuthClientSecret connection property.

In cases where introspection fails (e.g. when the access token expires), Vertica responds to the request with an error. If introspection fails and OAuthRefreshToken is specified, the driver attempts to refresh and silently retrieve a new access token. Otherwise, the driver passes error to the client application.

OAuthClientSecret The secret provided by your identity provider for your client. This parameter is required for confidential clients.

Encryption

Property Description Standard/ Vertica
SSLMode

Controls whether the connection to the database uses SSL encryption, one of the following. For information on using these parameters to configure TLS, see Configuring TLS for ODBC Clients:

  • require: Requires that the server use TLS. If the TLS connection attempt fails, the client rejects the connection.
  • prefer: Prefers that the server use TLS. The client first attempts to connect using TLS. If that attempt fails, the client attempts to connect again in plaintext.
  • allow: Makes a connection to the server whether the server uses TLS or not. The first connection attempt to the database is attempted over a clear channel. If that fails, a second connection is attempted over TLS.
  • verify_ca: The client verifies that the server's certificate was issued by a trusted certificate authority (CA).
  • verify_full: The client verifies that the following conditions are met:
  • The server's certificate was issued by a trusted CA.
  • One of the following:
    • The server's hostname matches the common name specified in the server's certificate.
    • The server's hostname or IP address appears in the Subject Alternative Name (SAN) field of the server's certificate.
  • disable: Never connect to the server using TLS. This setting is typically used for troubleshooting.

Default: prefer

Vertica
SSLCertFile The absolute path of the client's public certificate file. This file can reside anywhere on the system. Vertica
SSLKeyFile The absolute path to the client's private key file. This file can reside anywhere on the system. Vertica

Third-party compatibility

Property Description Default Standard/ Vertica
ColumnsAsChar

Specifies how character column types are reported when the driver is in Unicode mode. When set to false, the ODBC driver reports the data type of character columns as WCHAR. If you set ColumnsAsChar to true, the driver identifies character column as CHAR.

You typically use this setting for compatibility with some third-party clients.

Default: false

false Vertica
ThreePartNaming

A Boolean value that controls how catalog names are interpreted by the driver. When this value is false, the driver reports that catalog names are not supported. When catalog names are not supported, they cannot be used as a filter in database metadata API calls. In this case, the driver returns NULL as the catalog name in all driver metadata results.

When this value is true, catalog names can be used as a filter in database metadata API calls. In this case, the driver returns the database name as the catalog name in metadata results. Some third-party applications assume a certain catalog behavior and do not work properly with the default values. Enable this option if your client software expects to get the catalog name from the database metadata and use it as part of a three-part name reference.

Default: false for UNIX, true for Windows

false (UNIX)

true (Window)

Vertica
EnforceBatchInsertNullConstraints

Prevents NULL values from being loaded into columns with a NOT NULL constraint during batch inserts. When this value is set to true, batch inserts roll back when NULL values are inserted in to columns with NOT NULL constraints. When this value is set to false, batch insert behavior is unchanged.

Vertica recommends only using this property with SAP Data Services as it could negatively impact database performance.

false Vertica

Kerberos connection properties

Use the following properties for client authentication using Kerberos.

Property Description Standard/ Vertica
KerberosServiceName

Provides the service name portion of the Vertica Kerberos principal; for example: vertichost@EXAMPLE.COM

Default: vertica

Vertica
KerberosHostname

Provides the instance or host name portion of the Vertica Kerberos principal; for example: verticaosEXAMPLE.COM

Default: Value specified in the servername connection string property

Vertica

See also

ODBC driver settings

4.5 - Setting DSN connection properties

The properties in the following tables are common for all user and system DSN entries.

The properties in the following tables are common for all user and system DSN entries. The examples provided are for Windows clients.

To edit DSN properties:

  • On UNIX and Linux client platforms, you can edit the odbc.ini file. The location of this file is specific to the driver manager. See Creating an ODBC DSN for Linux.

  • On Windows client platforms, you can edit some DSN properties using the Vertica ODBC client driver interface. See Creating an ODBC DSN for windows clients.

  • You can also edit the DSN properties directly by opening the DSN entry in the Windows registry (for example, at HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\DSNname). Directly editing the registry can be risky, so you should only use this method for properties that cannot be set through the ODBC driver's user interface, or via your client code.

  • You can set properties in the connection string when opening a connection using the SQLDriverConnect() function:

    sqlRet = SQLDriverConnect(sql_hDBC, 0, (SQLCHAR*)"DSN=DSNName;Locale=en_GB@collation=binary", SQL_NTS, szDNS, 1024,&nSize, SQL_DRIVER_NOPROMPT);
    
  • Your client code can retrieve DSN property values after a connection has been made to Vertica using the SQLGetConnectAttr() and SQLGetStmtAttr() API calls. Some properties can be set and using SQLSetConnectAttr() and SQLSetStmtAttr().

    For details of the list of properties specific to Vertica see ODBC Header Files specific to Vertica.

5 - ODBC driver settings

While required settings are required for all platforms, these settings automatically set by the Windows and macOS installers, so all directives to change these settings are for Linux users.
  • DriverManagerEncoding: The UTF encoding standard used by the driver manager. This can be one of the following:

    • UTF-8

    • UTF-16

    • UTF-32

    The ODBC driver encoding must match that of your driver manager. The following table lists default encodings for various platforms that take effect if you do not set this parameter. If the defaults do not match the encoding used by your driver manager, you must set it manually. Consult your driver manager's documentation for details on its encoding.

    Client Platform Default Encoding
    Linux 32-bit UTF-32
    Linux 64-bit UTF-32
    Linux Itanium 64-bit UTF-32
    OS X UTF-32
    Windows 32-bit UTF-16
    Windows 64-bit UTF-16
  • ErrorMessagesPath: Required, the path of the directory containing the ODBC driver's error message files. These files (ODBCMessages.xml and VerticaMessages.xml) are stored in the same directory as the Vertica ODBC driver files (for example, opt/vertica/en-US in the downloaded .tar).

  • ODBCInstLib: The path to the ODBC installer library. This setting is only required if the directory containing the library is not set in the LD_LIBRARY_PATH or LIB_PATH environment variables. The library files for the major driver managers are:

  • UnixODBC: libodbcinst.so

  • iODBC: libiodbcinst.so (libiodbcinst.2.dylib on macOS)

  • DataDirect: libodbcinst.so

You can also control client-server message logging for both ODBC and ADO.NET. For details, see Configuring ODBC logs.

Linux and macOS

To set these parameters on Linux or macOS:

  1. Create a file vertica.ini anywhere on the client system. Common locations are in /etc/ for a shared configuration, or the home directory for a per-user configuration.

  2. Verify that users of the ODBC driver have read privileges on the file.

  3. Set the VERTICAINI environment variable to the path of vertica.ini. For example:

$ export VERTICAINI=/etc/vertica.ini
  1. Create a section called [Driver] in vertica.ini:
[Driver]
  1. Under [Driver], set parameters with the following format. Each parameter must have its own line:
[Driver]
DriverManagerEncoding=UTF-16
ODBCInstLib=/usr/lib64/libodbcinst.so

Windows

The Windows client driver installer automatically configures all necessary settings for the ODBC driver. Settings are stored in the registry in HKEY_LOCAL_MACHINE\SOFTWARE\Vertica\ODBC\Driver.

If you want to configure ODBC further, use the ODBC Data Sources program.

6 - Configuring ODBC logs

The following parameters control whether and how the ODBC client driver logs messages between the client and server.

The following parameters control whether and how the ODBC client driver logs messages between the client and server.

The way you set these parameters differs between operating systems:

  • On Linux and macOS, edit vertica.ini you created during the installation. For example, to log all warnings and more severe messages to log files in /tmp/:

    [Driver]
    LogLevel=4
    LogPath=/tmp
    
  • On Windows, edit the keys in the Windows Registry under HKEY_LOCAL_MACHINE\SOFTWARE\Vertica\ODBC\Driver.

Parameters

  • LogLevel: The severity of messages that are logged between the client and the server. The valid values are:

    • 0: No logging

    • 1: Fatal errors

    • 2: Errors

    • 3: Warnings

    • 4: Info

    • 5: Debug

    • 6: Trace (all messages)

    The value you specify for this setting sets the minimum severity for a message to be logged. For example, setting LogLevel to 3 means that the client driver logs all warnings, errors, and fatal errors.

  • LogPath: The absolute path of a directory to store log files. For example: /var/log/verticaodbc

Diverting log entires to ETW (windows)

On Windows clients, ODBC log entries can be sent to Event Tracing for Windows (ETW) so they appear in the Windows Event Viewer:

  • Register the driver as a Windows Event Log provider and enable the logs.

  • Activate ETW by adding a string value LogType with data ETW to your Windows Registry.

  • Understand how Vertica compresses log levels for the Windows Event Viewer.

  • Know where to find the logs within Event Viewer.

  • Understand the meaning of the Event IDs in your log entries.

Registering the ODBC driver as a windows event log provider

To use ETW logging, you must register the ODBC driver as a Windows Event Log provider. You can choose to register either the 32-bit or 64-bit driver. After you have registered the driver, you must enable the logs.

  1. Open a command prompt window as Administrator, or launch the command prompt with the Run as Administrator option.

  2. Run the command wevtutil im to register either the 32-bit or 64-bit version of the driver.

    • For the 64-bit ODBC driver, run:

      wevtutil im "c:\Program Files\Vertica Systems\ODBC64\lib\VerticaODBC64.man"
      /resourceFilePath:"c:\Program Files\Vertica Systems\ODBC64\lib\vertica_9.1_odbc_3.5.dll"
      /messageFilePath:"c:\Program Files\Vertica Systems\ODBC64\lib\vertica_9.1_odbc_3.5.dll"
      
    • For the 32-bit ODBC driver, run:

      wevtutil im "c:\Program Files (x86)\Vertica Systems\ODBC32\lib\VerticaODBC32.man"
      /resourceFilePath:"c:\Program Files (x86)\Vertica Systems\ODBC32\lib\vertica_9.1_odbc_3.5.dll"
      /messageFilePath:"c:\Program Files (x86)\Vertica Systems\ODBC32\lib\vertica_9.1_odbc_3.5.dll"
      
  3. Run the command wevtutil sl to enable the logs.

    • For 64-bit ODBC driver logs, run:

      wevtutil sl VerticaODBC64/e:true
      
    • For the 32-bit ODBC driver logs, run:

      wevtutil sl VerticaODBC32/e:true
      

Add the string value LogType

By default, Vertica does not send ODBC log entries to ETW. To activate ETW, add the string LogType to your Windows registry, and set its value to ETW.

  1. Start the registry editor by typing regedit.exe in the Windows Run command box.

  2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Vertica\ODBC\Driver in the registry.

  3. Right-click in the right pane of the Registry Editor window.

  4. Select New, then select String Value.

  5. Change the name of the string value from New Value #1 to LogType.

  6. Double-click the new LogType entry. When prompted for a new value, enter ETW.

  7. Exit the registry editor.

ETW is disabled by default. When ETW is enabled, you can disable it by clearing the value ETW from the LogType string.

LogLevel in the windows event viewer

While LogLevel ranges from 0 through 6, this range is compressed for the Windows Event Viewer to a range of 0 through 3.

Vertica LogLevel Setting Vertica LogLevel Description Log level sent to the Windows Event Viewer Log level displayed by the Windows Event Viewer
0 (No logging) 0 (No logging)
1 Fatal Errors 1 Critical
2 Errors 2 Error
3 Warnings 3 Warning
4 Info 4 Information
5 Debug 4
6 Trace (all messages) 4

The following examples show how LogLevel is converted when displayed in the Windows Event Viewer.

  • A LogLevel of 5 sends fatal errors, errors, warnings, info and debug log level entries to Event Viewer as Level 4 (Information).

  • A LogLevel of 6 sends fatal errors, errors, warnings, debug and trace log level entries to Event Viewer as Level 4.

Finding logs in the event viewer

  1. Launch the Windows Event Viewer.

  2. From Event Viewer (Local), expand Applications and Services Logs.

  3. Expand the folder that contains the log you want to review (for example, VerticaODBC64).

  4. Select the Vertica ODBC log under the folder. Entries appear in the right pane.

  5. Note the value in the Event ID field. Each Event Log entry includes one of four Event IDs:

    • 0: Informational (debug, info, and trace events)

    • 1: Error

    • 2: Fatal event

    • 3: Warning