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 Driver Configuration Options on page 1.

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 connector 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:

  • [AuthType] is the method that is used for authentication.
  • [OAuthMechanism] is the OAuth 2.0 authentication mechanism that is used for authentication.
  • [PortNumber] is the number of the TCP port that the proxy server uses to listen for client connections.
  • [Server] is the IP address or host name of the proxy server to which you are connecting.
  • [Token] is the security token that you obtain from Salesforce.com for authorizing access to Salesforce.
  • [YourClientID] is the client ID that is used for OAuth 2.0 authentication.
  • [YourClientSecret] is the client secret that is used for OAuth 2.0 authentication.
  • [YourPassword] is the password corresponding to your Salesforce user name.
  • [YourRefreshToken] is the refresh token that is used for OAuth 2.0 authentication.
  • [YourUserName] is the user name for your Salesforce account.

Connecting to Salesforce.com Directly

The following is the format of a DSN-less connection string for a standard connection to Salesforce.com:

Driver=Simba Salesforce ODBC Driver;UID=[YourUserName];

PWD=[YourPassword];

For example:

Driver=Simba Salesforce ODBC Driver;UID=simba;
PWD=simba;

Some Salesforce connections require you to provide a security token. The following is an example of a DSN-less connection string for a standard connection with a security token:

Driver=Simba Salesforce ODBC Driver;UID=simba;
PWD=simba;SecurityToken=abc123;

Note:

To obtain a security token, follow the instructions in the Salesforce documentation located at https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm

Connecting to Salesforce.com through a Proxy Server

The following is the format of a DSN-less connection string for connecting to Salesforce.com through a proxy server:

Driver=Simba Salesforce ODBC Driver;UID=[YourUserName];
PWD=[YourPassword];ProxyHost=[Server];ProxyPort=[PortNumber];

For example:

Driver=Simba Salesforce ODBC Driver;UID=simba;
PWD=simba;ProxyHost=192.168.222.160;ProxyPort=8000;

Some Salesforce connections require you to provide a security token. The following is the format of a DSN-less connection string for a proxy server connection with a security token:

Driver=Simba Salesforce ODBC Driver;UID=simba;
PWD=simba;SecurityToken=abc123;
ProxyHost=192.168.222.160;ProxyPort=8000;

Connecting to Salesforce.com using Basic authentication

The following is the format of a DSN-less connection string for connecting to Salesforce.com using Basic authentication:

Driver=SimbaSalesforce ODBC Driver;Auth_Type=[AuthType];UID=[YourUserName];PWD=[YourPassword];

For example:

Driver=SimbaSalesforce ODBC Driver;Auth_Type=Basic;UID=simba;PWD=simba;

Connecting to Salesforce.com using OAuth 2.0

The following is the format of a DSN-less connection string for connecting to Salesforce.com using OAuth 2.0 protocol:

Driver=SimbaSalesforce ODBC Driver;Auth_Type=[AuthType];OAuthMechanism=[OAuthMechanism];ClientId=[YourClientID];ClientSecret=[YourClientSecret];RefreshToken=[YourRefreshToken];

For example:

Driver=SimbaSalesforce ODBC Driver;Auth_Type=OAuth_2.0;OAuthMechanism=2;ClientId=45kn9Pcyq9pr4lvu123pfl4r57;ClientSecret=15kLtgactKYlqOqFxzuzvmFkKo0KM;RefreshToken=CH01pcNn/qFcYwUlJpkF_yyufYrqj4O4g7cdXvGgszT6;

Important:

Important:

The Auth_Type property currently only supports the values Basic or OAuth_2.0, and the OAuthMechanism property currently only supports the value 2.

Note:

To obtain a security token, follow the instructions in the Salesforce documentation located at https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm.