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 connector without a DSN. To connect to a data source without using a DSN, use a connection string instead. You can connect to the data source using either SQLBrowseConnect or SQLDriverConnect.

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

  • [AccessTokenInstance] is the generated access token for your ServiceNow instance.

  • [MaxOffset] is the maximum page size to retrieve rows.
  • [MaxPacketSize] is the HTTP response packet size for calculating page size.
  • [MinOffset] is the minimum page size to retrieve rows.
  • [YourAccessToken] is your access token for ServiceNow.
  • [YourClientID] is the client ID associated with your ServiceNow app.
  • [YourClientSecret] is the client secret associated with your ServiceNow app.
  • [YourInstanceURL] is the URL of your ServiceNow instance.
  • [YourPassword] is the password that you use to access ServiceNow.
  • [YourUserName] is the user name that you use to access ServiceNow.

Connecting to ServiceNow Using Basic Authentication

The following is the format of a DSN-less connection string for connecting to ServiceNow using basic authentication:

Driver=Simba ServiceNow ODBC Driver;Host=[YourInstanceURL];Auth_Type=Basic;UID=[YourUserName];PWD=[YourPassword];

For example:

Driver=Simba ServiceNow ODBC Driver;Host=https://instance12345.service-now.com;Auth_Type=Basic;UID=jsmith;PWD=simba123;

Connecting to ServiceNow Using Your ServiceNow App Information

The following is the format of a DSN-less connection string for connecting to ServiceNow using your app information. The connector initiates an OAuth 2.0 authentication flow based on the information and then uses the retrieved access token to authenticate the connection. For more information, see Security and Authentication.

Driver=Simba ServiceNowServiceNow ODBC Driver;Host=[YourInstanceURL];Auth_Type=OAuth_2.0;Auth_Client_ID=[YourClientID];Auth_Client_Secret=[YourClientSecret];UID=[YourUserName];PWD=[YourPassword];

For example:

Driver=Simba ServiceNow ODBC Driver;Host=https://instance12345.service-now.com;Auth_Type=OAuth_2.0;Auth_Client_ID=ABCABCABC123ABCABC45;Auth_Client_Secret=abCD+E1f2Gxhi3J4klmN/OP5QrSTuvwXYzabcdEF;UID=jsmith;PWD=simba123;

The following is the format of a DSN-less connection string for connecting to ServiceNow using your ServiceNow app information. The connector initiates an OAuth 2.0 authentication flow based on the information and then uses the retrieved access token to authenticate the connection. For more information, see Security and Authentication.

Driver=Simba ServiceNow ODBC Driver;Host=[YourInstanceURL];Auth_Type=OAuth_2.0;Auth_Client_ID=[YourClientID];Auth_Client_Secret=[YourClientSecret];UID=[YourUserName];PWD=[YourPassword];

For example:

Driver=Simba ServiceNow ODBC Driver;Host=https://instance12345.service-now.com;Auth_Type=OAuth_2.0;Auth_Client_ID=ABCABCABC123ABCABC45;Auth_Client_Secret=abCD+E1f2Gxhi3J4klmN/OP5QrSTuvwXYzabcdEF;UID=jsmith;PWD=simba123;

Connecting to ServiceNow Using an Access Token

The following is the format of a DSN-less connection string for connecting to the ServiceNow server using an access token:

Driver=Simba ServiceNow ODBC Driver;Host=[YourInstanceUrl];Auth_Type=Access Token;Auth_AccessToken=[AccessTokenInstance];

For example:

Driver=Simba ServiceNow ODBC Driver;Host=https://instance123.service-now.com;Auth_Type=Access Token;Auth_AccessToken=oa5bjsl9kndm;

Additional Example

The following is the format of a DSN-less connection string for connecting to ServiceNow using the MaxOffset, MinOffset, and MaxPacketSize properties:

Driver=Simba ServiceNow ODBC Driver;Host=[YourInstanceURL];Auth_Type=Basic;UID=[YourUserName];PWD=[YourPassword];UsePeerVerification=0;MinOffset=[MinOffset];MaxOffset=[MaxOffset];MaxPacketSize=[MaxPacketSize];

For example:

Driver=Simba ServiceNow ODBC Driver;Host=https://instance12345.service-now.com;Auth_Type=Basic;UID=jsmith;PWD=simba123;UsePeerVerification=0;

MinOffset=700;MaxOffset=5000;MaxPacketSize=600000;