Ready to get started?

Learn more about the CData JDBC Driver for Cosmos DB or download a free trial:

Download Now

Connect to Cosmos DB Data and Transfer Data in Talend

Integrate Cosmos DB data with standard components and data source configuration wizards in Talend Open Studio.

This article shows how you can easily integrate the CData JDBC driver for Cosmos DB into your workflow in Talend. This article uses the CData JDBC Driver for Cosmos DB to transfer Cosmos DB data in a job flow in Talend.

Connect to Cosmos DB in Talend as a JDBC Data Source

You can follow the procedure below to establish a JDBC connection to Cosmos DB:

  1. Add a new database connection to Cosmos DB data: To add a new connection, expand the Metadata node, right-click the Db Connections node, and then click Create Connection.
  2. In the resulting wizard, enter a name for the connection.
  3. On the next page, select Generic JDBC from the DB Type menu and enter the JDBC URL.

    To obtain the connection string needed to connect to a Cosmos DB account using the SQL API, log in to the Azure Portal, select Azure Cosmos DB, and select your account. In the Settings section, click Connection String and set the following values:

    • AccountEndpoint: The Cosmos DB account URL from the Keys blade of the Cosmos DB account
    • AccountKey: In the Azure portal, navigate to the Cosmos DB service and select your Azure Cosmos DB account. From the resource menu, go to the Keys page. Find the PRIMARY KEY value and set AccountKey to this value.

    Built-in Connection String Designer

    For assistance in constructing the JDBC URL, use the connection string designer built into the Cosmos DB JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

    java -jar cdata.jdbc.cosmosdb.jar

    Fill in the connection properties and copy the connection string to the clipboard.

    A typical JDBC URL is below:

    jdbc:cosmosdb:AccountEndpoint=myAccountEndpoint;AccountKey=myAccountKey;
  4. Enter the path to the cdata.jdbc.cosmosdb.jar file, located in the lib subfolder of the installation directory.
  5. Right-click the connection and then click Retrieve Schema.
  6. Click Next with the default options to select the tables you want to import.
  7. Finish the wizard with the default options.

Output the Customers Table to a Flat File

You can follow the procedure below to transfer the Customers table to a flat file output component:

  1. In the Table Schemas node, drag the tables to the workspace.
  2. In the dialog that is displayed, select the tJDBCInput component.
  3. Next, drag a tFileOutputDelimited component from the Business Intelligence tab of the Palette into the workspace.
  4. Right-click the Customers tJDBCInput component and drag a vector to the output file.

Run the project to transfer the data.