Using a Connection String

For some applications, you might need to use a connection string to connect to your data source. For detailed information about how to use a connection string in an ODBC application, refer to the documentation for the application that you are using.

The connection strings in the following sections are examples showing the minimum set of connection attributes that you must specify to successfully connect to the data source. Depending on the configuration of the data source and the type of connection you are working with, you might need to specify additional connection attributes. For detailed information about all the attributes that you can use in the connection string, see Connector Configuration Options.

DSN Connection String Example

The following is an example of a connection string for a connection that uses a DSN:

DSN=[DataSourceName]

[DataSourceName] is the DSN that you are using for the connection.

You can set additional configuration options by appending key-value pairs to the connection string. Configuration options that are passed in using a connection string take precedence over configuration options that are set in the DSN.

DSN-less Connection String Examples

Some applications provide support for connecting to a data source using a driver without a DSN. To connect to a data source without using a DSN, use a connection string instead.

The placeholders in the examples are defined as follows, in alphabetical order:

  • [ClientID] is the OAuth 2.0 client ID used to generate the completed redirect URI and the authorization URL.
  • [ClientSecret] is the OAuth 2.0 client secret used to generate the completed redirect URI and the authorization URL.
  • [CustomerID] is the client customer ID that you want the connector to use by default for API requests.
  • [DevToken] is the developer token associated with the manager account that you use to grant access to the Ads API.
  • [LoginID] is the client customer ID of the Simba Google Ads ODBC Connector Manager account through which you want to retrieve customer report data for.
  • [Scope] is a comma-separated list of OAuth scopes for the access token.
  • [Server] is the IP address or host name of the proxy server to which you are connecting.
  • [ServiceAccount] is your service account email ID.
  • [ServiceKeyPath] is the full path to a .p12 or .json key file for service account authentication.

Connecting to Ads Using an Access Token

The following is the format of a DSN-less connection string for connecting to Ads using an access token with Client account credentials:

Driver=Simba GoogleAds ODBC Driver;Host=[Server];
Auth_Type=Access Token;Auth_AccessToken=[YourToken];Developer_Token=[DevToken];Client_Customer_Id=[CustomerID];

For example:

Driver=Simba GoogleAds ODBC Driver;
Host=192.168.222.110/googleads3;Auth_Type=Access Token;Auth_AccessToken=kP9PcyQ7prK2LwUMZMpF;Developer_Token=xMb7jYlA8RpKf3SQB1K9jU;Client_Customer_Id=423556746;

The following is the format of a DSN-less connection string for connecting to Ads using an access token with Manager account credentials:

Driver=Simba GoogleAds ODBC Driver;Host=[Server];
Auth_Type=Access Token;Auth_AccessToken=[YourToken];Developer_Token=[DevToken];Client_Customer_Id=[CustomerID];Login_Customer_Id=[LoginID];

For example:

Driver=Simba GoogleAds ODBC Driver;
Host=googleads.googleapis.com;Auth_Type=Access Token;Auth_AccessToken=kN9PcyQ9prK4LvUMMMpFL4R+lVE;Developer_Token=jgkdlfjdkfjdf;Client_Customer_Id=7423556746;Login_Customer_Id=7989840436;

Connecting to Ads Using OAuth 2.0

The following is the format of a DSN-less connection string for connecting to Ads using OAuth 2.0 with Client account credentials:

Driver=Simba GoogleAds ODBC Driver;Host=[Server];
Auth_Type=OAuth 2.0;Auth_Scope=[Scope];Auth_Client_ID=[ClientID];Auth_Client_Secret=[ClientSecret]Developer_Token=[DevToken];Client_Customer_Id=[CustomerID];

For example:

Driver=Simba GoogleAds ODBC Driver;
Host=192.168.222.110/googleads3;Auth_Type=OAuth 2.0;Auth_Scope=https://www.googleapis.com/auth/adwords;Auth_Client_ID=t4tuefm3fkdfijdjrerlsgv345j;Auth_Client_Secret=78hfdhfkdlfjeirjerrekjriutug;Developer_Token=jgkdlfjdkfjdf;Client_Customer_Id=423556746;

The following is the format of a DSN-less connection string for connecting to Ads using OAuth 2.0 with Manager account credentials:

Driver=Simba GoogleAds ODBC Driver;Host=[Server];
Auth_Type=OAuth 2.0;Auth_Scope=[Scope];Auth_Client_ID=[ClientID];Auth_Client_Secret=[ClientSecret];Developer_Token=[DevToken];Client_Customer_Id=[CustomerID];Login_Customer_Id=[LoginID];

For example:

Driver=Simba GoogleAds ODBC Driver;Auth_Type=OAuth 2.0;Host=googleads.googleapis.com;Auth_Scope=https://www.googleapis.com/auth/adwords;Auth_Client_ID=t4tuefm3fkdfijdjrerlsgv345j;Auth_Client_Secret=78hfdhfkdlfjeirjerrekjriutug;Developer_Token=jgkdlfjdkfjdf;Client_Customer_Id=7423556746;Login_Customer_Id=7989840436;

Connecting to Ads using Service Authentication

The following is the format of a DSN-less connection string for a service account connection to Ads using Client account credentials:

Driver=Simba GoogleAds ODBC Driver;
Auth_Email=[ServiceAccount];Auth_KeyFilePath=[ServiceKeyPath];Developer_Token=[DevToken];Client_Customer_Id=[CustomerID];

For example:

Driver=Simba GoogleAds ODBC Driver;
Auth_Email=application-service-account@iam.gserviceaccount.com;
Auth_KeyFilePath=C:\SecureFiles\ServiceKeyFile.p12;
Developer_Token=xMb7jYlA8RpKf3SQB1K9jU;Client_Customer_Id=423556746;

The following is the format of a DSN-less connection string for a service account connection to Ads using Manager account credentials:

Driver=Simba GoogleAds ODBC Driver;
Auth_Email=[ServiceAccount];Auth_KeyFilePath=[ServiceKeyPath];Developer_Token=[DevToken];Client_Customer_Id=[CustomerID];Login_Customer_Id=[LoginID];

For example:

Driver=Simba GoogleAds ODBC Driver;
Auth_Email=application-service-account@iam.gserviceaccount.com;
Auth_KeyFilePath=C:\SecureFiles\ServiceKeyFile.p12;
Developer_Token=xMb7jYlA8RpKf3SQB1K9jU;Client_Customer_Id=423556746;Login_Customer_Id=7989840436;