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 on a non-Windows machine:

  1. In a text editor, open the odbc.ini configuration file.

    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.

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

    For example, on a macOS machine:

    [ODBC Data Sources]

    Sample DSN=Simba Apache Drill ODBC Connector

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

    [ODBC Data Sources]

    Sample DSN=Simba Apache Drill ODBC Connector 32-bit

  3. 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/drill/lib/libdrillodbc_sbu.dylib

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

      Driver=/opt/simba/drill/lib/32/libdrillodbc_sb32.so

    3. Choose one:
      • To connect to a Drill server, do the following:
        1. Set the ConnectionType property to Direct.
        2. Set the Host property to the IP address or host name of the server.
        3. The connector accepts both IPv4 and IPv6 addresses. To specify an IPv6 address, you must use the format [IP_Address]%[Scope_ID], where [IP_Address] is the IP address of the Drill server and [Scope_ID] is the scope ID of the client machine. For example, if the IP address is fe80::b221:9391:6500:3a3f and the scope ID is 2, you would set the following:

          Host=fe80::b221:9391:6500:3a3f%2

        4. Set the Port property to the TCP port that the server uses to listen for client connections.
      • For example:

        ConnectionType=Direct

        Host=192.168.222.160

        Port=31010

      • Or, to connect to a ZooKeeper cluster, do the following:
        1. Set the ConnectionType property to ZooKeeper.
        2. Set the ZKClusterID property to the name of the ZooKeeper cluster.
        3. Set the ZKQuorum property to a comma-separated list of the servers in the cluster, specifying the host names or IP addresses and port numbers.
      • For example:

        ConnectionType=ZooKeeper

        ZKClusterID=drill

        ZKQuorum=192.168.222.160:31010, 192.168.222.165:31010,192.168.222.231:31010

    4. If authentication is required to access the server, then specify the authentication mechanism and your credentials. For more information, see Configuring Authentication.
    5. Note:

      If you set AuthenticationType to No Authentication, the connector uses a default user name of "anonymous".

    6. 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 Apache Drill ODBC Connector, see Driver Configuration Options on page 1.
  4. Save the odbc.ini configuration file.
    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 a Drill server without authentication:

    [ODBC Data Sources]

    Sample DSN=Simba Apache Drill ODBC Connector

    [Sample DSN]

    Driver=/Library/simba/drill/lib/libdrillodbc_sbu.dylib

    ConnectionType=Direct

    Host=192.168.222.160

    Port=31010

    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 a Drill server without authentication:

    [ODBC Data Sources]

    Sample DSN=Simba Apache Drill ODBC Connector 32-bit

    [Sample DSN]

    Driver=/opt/simba/drill/lib/32/libdrillodbc_sb32.so

    ConnectionType=Direct

    Host=192.168.222.160

    Port=31010

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