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.

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

  • [Endpoint] is the host or base URL for the Amazon S3 server that you are connecting to.
  • [YourAccessKey] is the access key ID that you use to access Amazon S3.
  • [YourAccessToken] is your access token for Amazon S3.
  • [YourPath] is the full path of the .pem file containing trusted CA certificates for verifying the server during SSL authentication.
  • [YourSecretKey] is the secret access key corresponding to your access key ID.

Connecting to Amazon S3 Using Access Keys

The following is the format of a DSN-less connection string that connects to Amazon S3 using an access key and a secret key:

Driver=Simba Amazon Amazon S3 ODBC Driver;Host=[Endpoint];
AccessKey=[YourAccessKey];SecretKey=[YourSecretKey];Region=[Region];

For example:

Driver=Simba Amazon Amazon S3 ODBC Driver;Host=s3.amazonaws.com;
AccessKey=ABCABCABC123ABCABC45;
SecretKey=abCD+E1f2Gxhi3J4klmN/OP5QrSTuvwXYzabcdEF;Region=[Region];

Connecting to Amazon S3 Using Temporary Security Credentials

Temporary credentials consist of an access key ID, a secret access key, and a session token. Because the session token expires after some time, these credentials are only valid for a limited amount of time. You have the option of using a specific session token for the connection, or configuring the connector to automatically retrieve session tokens based on your access key and secret key.

Note: To request a set of temporary credentials, contact your Amazon Amazon S3 server administrator.

The following is the format of a DSN-less connection string that connects to Amazon S3 using temporary credentials, and allows the connector to retrieve new session tokens as needed:

Driver=Simba Amazon Amazon S3 ODBC Driver;Host=[Endpoint];
AccessKey=[YourAccessKey];SecretKey=[YourSecretKey];
EnableSessionToken=1;Region=[Region];

For example:

Driver=Simba Amazon Amazon S3 ODBC Driver;
Host=https://s3.amazonaws.com;
AccessKey=ABCABCABC123ABCABC45;EnableSessionToken=1;
SecretKey=abCD+E1f2Gxhi3J4klmN/OP5QrSTuvwXYzabcdEF;Region=[Region];

To use a specific session token instead of one that is automatically retrieved by the connector, include the SessionToken property and set it to your session token. For example:

Driver=Simba Amazon Amazon S3 ODBC Driver;
Host=https://s3.amazonaws.com;
AccessKey=ABCABCABC123ABCABC45;EnableSessionToken=1;
SecretKey=abCD+E1f2Gxhi3J4klmN/OP5QrSTuvwXYzabcdEF;
SessionToken=aBCd/eFGhiJkLMnoPQr9S+tUVWx8YZaBCDEfgHiJK;Region=[Region];

Connecting to Amazon S3 Using Windows Trust Store

The following is the format of a DSN-less connection string for connecting to the Amazon S3 server that requires SSL and uses the Windows trust store:

Driver=SimbaAmazon S3 ODBC Driver;Host=[Endpoint];Auth_Type=Access Token;Auth_AccessToken=[YourAccessToken];SystemTrustStore=1;

For example:

Driver=SimbaAmazon S3 ODBC Driver;Host=https://s3.amazonaws.com;Auth_Type=OAuth_2.0;Auth_AccessToken=
kN9PcyQ9prK4LvL4R+lVE=;SystemTrustStore=1;

The following is the format of a DSN-less connection string for connecting to the Amazon S3 server that requires SSL and uses the path provided in the TrustCertsPath property:

Driver=SimbaAmazon S3 ODBC Driver;Host=[Endpoint];Auth_Type=Access Token;Auth_AccessToken=[YourAccessToken];SystemTrustStore=0;TrustCertsPath=[YourPath];

For example:

Driver=SimbaAmazon S3 ODBC Driver;Host=https://s3.amazonaws.com;Auth_Type=OAuth_2.0;Auth_AccessToken=
kN9PcyQ9prK4LvL4R+lVE=;SystemTrustStore=0;TrustCertsPath=C:\Users\JSmith\Desktop\Cert\Amazon S3.pem;