JDBC Driver for Cloudant

Build 22.0.8462

Establishing a Connection

Creating a JDBC Data Source

You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for Cloudant consists of three basic steps:

  • Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
  • Provide the driver class. For example:
    cdata.jdbc.cloudant.CloudantDriver
  • Provide the JDBC URL. For example:
    jdbc:cloudant:User=abc123; Password=abcdef;
    
    or
    
    jdbc:cdata:cloudant:User=abc123; Password=abcdef;

    The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:cloudant:" or "jdbc:cdata:cloudant:" and can include any of the connection properties in name-value pairs separated with semicolons.

Authenticating to Cloudant

There are two authentication methods available for connecting to Cloudant: IBM Cloudant Legacy and IBM Cloud IAM.

IBM Cloudant Legacy

Set the User and Password to your service credentials.

To create an IBM Cloudant service credential:

  1. In the IBM Cloud dashboard, go to the Menu icon > Resource List, and open your IBM Cloudant service instance.
  2. In the menu, click Service credentials.
  3. Click New credential and enter a name for the new credential in the Add new credential window.
  4. Click Add. This adds your credentials to the Service credentials table.
  5. Click Actions > View credentials and extract the User and Password from the JSON file.

IBM Cloud IAM

IBM Cloud IAM

To connect with IBM Cloud, you will need the ApiKey and the Url of Cloudant instance ( i.e https://0c9d3837-8304-4aab-a65a-648169970943-bluemix.cloudant.com). After setting InitiateOAuth to GETANDREFRESH (default), you are ready to connect.

When you connect, the driver completes the OAuth process.

  1. Extracts the access token and authenticates requests.
  2. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.

After you have created an account in IBM Cloud you should follow the procedure below to retrieve the connection properties:

API Key

To obtain the ApiKey, take the following steps:

  1. Log in to your IBM Cloud account.
  2. Navigate to Platform API Keys page.
  3. On the middle right corner click "Create an IBM Cloud API Key" in order to create a new API Key.
  4. In the pop-up window, specify the API Key name and click "Create". Save the ApiKey somewhere as you can never access it again from the dashboard.

Register a new instance of Cloudant

If you do not already have Cloud Object Storage in your IBM Cloud account, you can follow the procedure below to install an instance of SQL Query in your account:

  1. Log in to your IBM Cloud account.
  2. Navigate to the Cloudant page, choose a name for your instance and click Create. You will be redirected to the instance of Cloudant.

Local Instances

We support Local instances from version 1.1.0 and above.

To authenticate to your local instance:

  1. Url: Set to the Url of your local instance. For example: http://localhost:8006
  2. User: Set to your Username.
  3. Password: Set to your Password.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462