Creating a Data Source Name

When connecting to your data store using a DSN, you only need to configure the odbc.ini file. Set the properties in the odbc.ini file to create a DSN that specifies the connection information for your data store. For information about configuring a DSN-less connection instead, see Configuring a DSN-less Connection.

If your machine is already configured to use an existing odbc.ini file, then update that file by adding the settings described below. Otherwise, copy the odbc.ini file from the Setup subfolder in the connector installation directory to the home directory, and then update the file as described below.

To create a Data Source Name:

  1. In a text editor, open the odbc.ini configuration file.
  2. Note: If you are using a hidden copy of the odbc.ini file, you can remove the period (.) from the start of the file name to make the file visible while you are editing it.

  3. In the [ODBC Data Sources] section, add a new entry by typing a name for the DSN, an equal sign (=), and then the name of the connector.
  4. For example, on a macOS machine:

    [ODBC Data Sources]

    Sample DSN=Simba PostgreSQL ODBC Driver

    For example, for a 32-bit connector on a Linux machine:

    [ODBC Data Sources]

    Sample DSN=Simba PostgreSQL ODBC Driver 32-bit

  5. Create a section that has the same name as your DSN, and then specify configuration options as key-value pairs in the section:
    1. Set the Driver property to the full path of the connector library file that matches the bitness of the application.
    2. For example, on a macOS machine:

      Driver=/Library/simba/postgresqlodbc/lib/libpostgresqlodbc_sbu.dylib

      For example, for a 32-bit connector on a Linux machine:

      Driver=/opt/simba/postgresqlodbc/lib/32/libpostgresqlodbc_sb32.so

    3. Set the Server property to a comma-delimited list of endpoint servers you want to connect to, and then set the Port property to the number of the TCP port that these servers use to listen for client connections.

      For example:

      Server=testserver.abcabcabcabc.com,testserver.cbacbacba.com,

      Port=5439

    4. Set the Database property to the name of the database that you want to access.
    5. For example:

      Database=TestDB

    6. To configure authentication, do one of the following:
      • To use standard authentication, do the following:
        1. Set the UseKerberos property to 0.
        2. Set the UID property to your user name for accessing the PostgreSQL server.
        3. Set the PWD property to the password corresponding to the user name that you provided in the previous step.
      • For example:

        UseKerberos=0

        UID=simba

        PWD=simba123

      • Or, to use Kerberos authentication, do the following:
        1. Set the UseKerberos property to 1.
        2. Set the UID property to your user name for accessing the PostgreSQL server.
        3. Set the KerberosServiceName property to the Kerberos service principal name of the PostgreSQL server.
      • For example:

        UseKerberos=1

        UID=simba

        KerberosServiceName=simba_postgresql

    7. To connect to the server through SSL, enable SSL and specify the certificate information. For more information, see Configuring SSL Verification.
    8. Optionally, modify how the connector runs queries and retrieves results into memory. For more information, see Configuring Query Processing Modes.
    9. Optionally, configure the connector to connect through a proxy server. For more information, see Configuring a Proxy Connection.
    10. Optionally, modify the TCP keepalive settings that the connector uses to prevent connections from timing out. For more information, see Configuring TCP Keepalives.
    11. Optionally, set additional key-value pairs as needed to specify other optional connection settings. For detailed information about all the configuration options supported by the Simba PostgreSQL ODBC Connector, see Driver Configuration Options on page 1.
  6. Save the odbc.ini configuration file.
  7. Note:

    If you are storing this file in its default location in the home directory, then prefix the file name with a period (.) so that the file becomes hidden. If you are storing this file in another location, then save it as a non-hidden file (without the prefix), and make sure that the ODBCINI environment variable specifies the location. For more information, see Specifying the Locations of the Connector Configuration Files.

For example, the following is an odbc.ini configuration file for macOS containing a DSN that connects to PostgreSQL:

[ODBC Data Sources]

Sample DSN=Simba PostgreSQL ODBC Driver

[Sample DSN]

Driver=/Library/simba/postgresqlodbc/lib/libpostgresqlodbc_sb u .dylib

Server=192.168.222.160

Port=5432

Database=TestDB

UseKerberos=0

UID=simba

PWD=simba123

For example, the following is an odbc.ini configuration file for a 32-bit connector on a Linux machine, containing a DSN that connects to PostgreSQL:

[ODBC Data Sources]

Sample DSN=Simba PostgreSQL ODBC Driver 32-bit

[Sample DSN]

Driver=/opt/simba/postgresqlodbc/lib/32/libpostgresqlodbc_sb32.so

Server=192.168.222.160

Port=5432

Database=TestDB

UseKerberos=0

UID=simba

PWD=simba123

You can now use the DSN in an application to connect to the data store.