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,
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.
Important:
When you connect to the data store using a DSN-less connection string, the connector does not encrypt your credentials.
The placeholders in the examples are defined as follows, in alphabetical order:
- [Name] is the name of the profile to use from the AWS credentials file.
- [Path] is the full path and name of your AWS credentials file.
- [PortNumber] is the number of the TCP port that the DynamoDB Local server uses to listen for client connections.
- [RegionCode] is the AWS region to use for your connection.
- [Server] is the IP address of the server on DynamoDB Local.
- [YourAccessKey] is the access key ID that you use to access the DynamoDB service on AWS.
- [YourSecretKey] is the secret access key corresponding to your access key ID.
- [YourSessionToken] is the session token to use when connecting to DynamoDB using temporary security credentials.
Connecting to the DynamoDB Service on AWS Using a Credentials File
The following is the format of a DSN-less connection string that connects to the DynamoDB service using an AWS credentials file:
Driver=SimbaDynamoDB ODBC Driver;
Host=dynamodb.[RegionCode].amazonaws.com;
Region=[RegionCode];AuthMechanism=1;
CredentialFile=[Path];ProfileName=[Name];
For example:
Driver=SimbaDynamoDB ODBC Driver;
Host=dynamodb.us-west-2.amazonaws.com;Region=us-west-2;
AuthMechanism=1;CredentialFile=C:\credentials.txt;
ProfileName=simba;
Connecting to the DynamoDB Service on AWS Using Access Keys
The following is the format of a DSN-less connection string that connects to the DynamoDB service using an access key and a secret key:
Driver=Simba DynamoDB ODBC Driver;
Host=dynamodb.[RegionCode].amazonaws.com;
Region=[RegionCode];AuthMechanism=0;
AccessKey=[YourAccessKey];SecretKey=[YourSecretKey];
For example:
Driver=Simba DynamoDB ODBC Driver;
Host=dynamodb.us-west-2.amazonaws.com;Region=us-west-2;
AuthMechanism=0;AccessKey=ABCABCABC123ABCABC45;
SecretKey=abCD+E1f2Gxhi3J4klmN/OP5QrSTuvwXYzabcdEF;
Connecting to the DynamoDB Service on AWS Using Temporary Security Credentials
Temporary credentials consist of an access key, a secret key, and a session token, which are only valid for a limited amount of time. Contact your DynamoDB server administrator to get temporary credentials.
The following is the format of a DSN-less connection string that connects to the DynamoDB service using temporary security credentials:
Driver=Simba DynamoDB ODBC Driver;
Host=dynamodb.[RegionCode].amazonaws.com;
Region=[RegionCode];AuthMechanism=0;
AccessKey=[YourAccessKey];SecretKey=[YourSecretKey];
TempCredentials=1;SessionToken=[YourSessionToken];
For example:
Driver=Simba DynamoDB ODBC Driver;
Host=dynamodb.us-west-2.amazonaws.com;Region=us-west-2;
AuthMechanism=0;AccessKey=ABCABCABC123ABCABC45;
SecretKey=abCD+E1f2Gxhi3J4klmN/OP5QrSTuvwXYzabcdEF;
TempCredentials=1;
SessionToken=aBCd/eFGhiJkLMnoPQr9S+tUVWx8YZaBCDEfgHiJK;
Connecting to a Server on DynamoDB Local
The following is the format of a DSN-less connection string that connects to a server on DynamoDB Local:
Driver=Simba DynamoDB ODBC Driver;
DynamoDBLocal=1;Host=[Server];Port=[PortNumber];
Region=[RegionCode];AccessKey=[YourAccessKey];
SecretKey=[YourSecretKey];
For example:
Driver=Simba DynamoDB ODBC Driver;
DynamoDBLocal=1;Host=192.168.222.160;Port=8000;
Region=us-west-2;AccessKey=ABCABCABC123ABCABC45;
SecretKey=NullText;
For information about how the Region, Access Key, and Secret Key values are used in connections to DynamoDB Local, see "DynamoDB Local for Desktop Development" in the AWS Official Blog: https://aws.amazon.com/blogs/aws/dynamodb-local-for-desktop-development.
Related topics
- Driver Configuration Options on page 1
- Creating a Data Source Name
- Creating a Data Source Name
- Configuring a DSN-less Connection
- Configuring the Driver on page 1