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 Couchbase ODBC Driver

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

    [ODBC Data Sources]

    Sample DSN=Simba Couchbase 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/couchbaseodbc/lib/libcouchbaseodbc_sbu.dylib

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

      Driver=/opt/simba/couchbaseodbc/lib/32/libcouchbaseodbc_sb32.so

    3. Set the Server property to the IP address or host name of the server, and then set the Port property to the number of the TCP port that the server uses to listen for client connections.
    4. For example:

      Host=192.168.222.160

      Port=8093

    5. If connection over Secure Sockets Layer (SSL) is required to access the Couchbase Server instance, then enable SSL and specify a .pem file containing the trusted CA certificates or the default root certificate of your installed Couchbase Server instance. For more information, see Configuring SSL Verification.
    6. If authentication is required to access the server, then specify the authentication mechanism and your credentials. For more information, see Configuring Authentication.
    7. If you are using a schema definition that is stored in a local JSON file, then set the LocalSchemaFile property to the full path of the file containing the schema definition.
    8. For example:

      LocalSchemaFile=/localhome/simba/schemas/couchbase_schema.json

      Note:

      • If you connect to the data store without specifying a schema definition, and the data store does not already contain a valid schema definition, then the connector automatically generates a temporary schema definition in order to support the connection.
      • Schema definitions that were created using connector version 1.1.2 or earlier are not supported, and must be recreated using the Schema Editor application or the SchemaMapOperation connection property. For information about how to use the Schema Editor, see the Schema Editor User Guide located in the installation directory of the connector. For information about using connection properties to work with schema definitions, see Working with Schema Definitions Using Connection Properties.
    9. 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 Couchbase ODBC Driver, 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 Couchbase and uses the schema definition stored in the database (the LocalSchemaFile does not need to be set):

[ODBC Data Sources]

Sample DSN=Simba Couchbase ODBC Driver

[Sample DSN]

Driver=/Library/simba/couchbaseodbc/lib/libcouchbaseodbc_sbu.dylib

Host=192.168.222.160

Port=8093

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 Couchbase and uses the schema definition stored in the database (the LocalSchemaFile does not need to be set):

[ODBC Data Sources]

Sample DSN=Simba Couchbase ODBC Driver 32-bit

[Sample DSN]

Driver=/opt/simba/couchbaseodbc/lib/32/libcouchbaseodbc_sb32.so

Host=192.168.222.160

Port=8093

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