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 Google BigQuery ODBC Connector

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

    [ODBC Data Sources]

    Sample DSN=Simba Google BigQuery ODBC Connector 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/googlebigqueryodbc/lib/libgooglebigqueryodbc_sbu.dylib

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

      Driver=/opt/simba/googlebigqueryodbc/lib/32/libgooglebigqueryodbc_sb32.so

    3. Set the Catalog property to the name of your BigQuery project. This project is the default project that the Simba Google BigQuery ODBC Connector queries against, and also the project that is billed for queries that are run using this DSN.
    4. For example:

      Catalog=testdata

    5. Configure authentication using a Google user account or a Google service account. For more information, see Configuring Authentication.
    6. Optionally, to use trusted CA certificates from a .pem file other than the default file installed with the connector, set the TrustedCerts property to the full path of the file.
    7. Optionally, to allow the connector to access Google Drive so that it can support federated tables that combine BigQuery data with data from Google Drive, set the RequestGoogleDriveScope property to 1.
    8. 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 Google BigQuery 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 Google BigQuery using a refresh token obtained from a user account:

[ODBC Data Sources]

Sample DSN=Simba Google BigQuery ODBC Connector

[Sample DSN]

Driver=/Library/simba/googlebigqueryodbc/lib/libgooglebigqueryodbc_sbu.dylib

Catalog=testdata

OAuthMechanism=1

RefreshToken=CH01pcNn/qFcYwUlJpkF_yyufYrqj4O4g7cdXvGgs-zT6

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 Google BigQuery using a refresh token obtained from a user account:

[ODBC Data Sources]

Sample DSN=Simba Google BigQuery ODBC Connector 32-bit

[Sample DSN]

Driver=/opt/simba/googlebigqueryodbc/lib/32/libgooglebigqueryodbc_sb32.so

Catalog=testdata

OAuthMechanism=1

RefreshToken=CH01pcNn/qFcYwUlJpkF_yyufYrqj4O4g7cdXvGgs-zT6

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