SQLServerCentral Article

Connecting to Amazon DocumentDB with MongoDB Drivers

,

With Amazon DocumentDB developers and DBAs can balance availability, read scalability, and latency with five pre-configured consistency levels. The data in an Amazon DocumentDB cluster is accessible just like a MongoDB 3.6 cluster. The CData Software Drivers for MongoDB provide a SQL-like interface to MongoDB data through standards-based drivers. This allows users to see their data in the BI, reporting, and ETL tools of their choice, as well as in custom tools and applications.

This article walks through configuring an Amazon DocumentDB cluster and connecting to the cluster through any of the available CData Software MongoDB drivers.

Creating a DocumentDB Cluster

To create a DocumentDB cluster, log in to your AWS Console, select Amazon DocumentDB, click Clusters and Create to add a new cluster. Once you create the cluster, you can connect to the cluster using the MongoDB client from an EC2 instance to populate the cluster. Once you have data in the Amazon DocumentDB cluster, you can connect using the CData MongoDB Drivers.

Connecting to a Amazon DocumentDB Cluster

With your cluster created, make note of the cluster details (found by clicking on the cluster name on the Clusters page).

Image description

The table below describes the mapping from the DocumentDB cluster details to the CData Driver properties:

  • CData Driver Property | Amazon DocumentDB Property
  • Server --> Cluster endpoint
  • Port --> Port
  • User --> Master username
  • Password --> (set when you create the cluster)

In addition to the cluster details, you need to set a few more additional properties in the CData drivers to connect to an Amazon DocumentDB cluster:

  • UseSSL: True (Amazon DocumentDB Clusters have SSL enabled by default and this cannot be changed.)
  • SSLServerCert: * (This automatically accepts the certificate presented by the DocumentDB Cluster, which is already hosted within the same region and security group as the EC2 instance.)
  • Other: "UseFindAPI=true" (This is set to ensure compatibility with the DocumentDB version of the MongoDB API.)

With all of the properties, your standard connection string would look like the following:

Server=.cluster-xxxxxxxxxxxx..docdb.amazonaws.com; Port=27107; User=myMaster; Password=myPassword; UseSSL=True; SSLServerCert=*; Other='UseFindAPI=True';

Once the connection properties are set, you can quickly connect to your Amazon DocumentDB account using any of the MongoDB Drivers.

More Information

When developing modern applications, document databases like MongoDB are a popular choice for storing semi-structured data for use cases like product catalogs, user profiles, mobile applications, and content management.

The MongoDB ODBC Driver is a powerful tool that allows you to connect with live MongoDB document databases, directly from any applications that support ODBC connectivity. Access MongoDB like you would a database - read, write, and update through a standard ODBC Driver interface.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating