Ready to get started?

Download a free trial of the IBM Cloud Object Storage Driver to get started:

 Download Now

Learn more:

IBM Cloud Object Storage Icon IBM Cloud Object Storage JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with IBM Cloud Object Storage.

Load IBM Cloud Object Storage Data to a Database Using Embulk



Use CData JDBC Driver for IBM Cloud Object Storage with the open source ETL/ELT tool Embulk to load IBM Cloud Object Storage data to a database.

Embulk is an open source bulk data loader. When paired with the CData JDBC Driver for IBM Cloud Object Storage, Embulk easily loads data from IBM Cloud Object Storage to any supported destination. In this article, we explain how to use the CData JDBC Driver for IBM Cloud Object Storage in Embulk to load IBM Cloud Object Storage data to a MySQL dtabase.

With built-in optimized data processing, the CData JDBC Driver offers unmatched performance for interacting with live IBM Cloud Object Storage data. When you issue complex SQL queries to IBM Cloud Object Storage, the driver pushes supported SQL operations, like filters and aggregations, directly to IBM Cloud Object Storage and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations).

Configure a JDBC Connection to IBM Cloud Object Storage Data

Before creating a bulk load job in Embulk, note the installation location for the JAR file for the JDBC Driver (typically C:\Program Files\CData\CData JDBC Driver for IBM Cloud Object Storage\lib).

Embulk supports JDBC connectivity, so you can easily connect to IBM Cloud Object Storage and execute SQL queries. Before creating a bulk load job, create a JDBC URL for authenticating with IBM Cloud Object Storage.

Register a New Instance of Cloud Object Storage

If you do not already have Cloud Object Storage in your IBM Cloud account, 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 page, choose a name for your instance and click Create. You will be redirected to the instance of Cloud Object Storage you just created.

Connecting using OAuth Authentication

There are certain connection properties you need to set before you can connect. You can obtain these as follows:

API Key

To connect with IBM Cloud Object Storage, you need an API Key. You can obtain this as follows:

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

Cloud Object Storage CRN

If you have multiple accounts, you will need to specify the CloudObjectStorageCRN explicitly. To find the appropriate value, you can:

  • Query the Services view. This will list your IBM Cloud Object Storage instances along with the CRN for each.
  • Locate the CRN directly in IBM Cloud. To do so, navigate to your IBM Cloud Dashboard. In the Resource List, Under Storage, select your Cloud Object Storage resource to get its CRN.

Connecting to Data

You can now set the following to connect to data:

  • InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
  • ApiKey: Set this to your API key which was noted during setup.
  • CloudObjectStorageCRN (Optional): Set this to the cloud object storage CRN you want to work with. While the connector attempts to retrieve this automatically, specifying this explicitly is recommended if you have more than Cloud Object Storage account.

When you connect, the connector completes the OAuth process.

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

Built-in Connection String Designer

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

java -jar cdata.jdbc.ibmcloudobjectstorage.jar

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

Below is a typical JDBC connection string for IBM Cloud Object Storage:

jdbc:ibmcloudobjectstorage:ApiKey=myApiKey;CloudObjectStorageCRN=MyInstanceCRN;Region=myRegion;OAuthClientId=MyOAuthClientId;OAuthClientSecret=myOAuthClientSecret;

Load IBM Cloud Object Storage Data in Embulk

After installing the CData JDBC Driver and creating a JDBC connection string, install the required Embulk plugins.

Install Embulk Input & Output Plugins

  1. Install the JDBC Input Plugin in Embulk.
    https://github.com/embulk/embulk-input-jdbc/tree/master/embulk-input-jdbc
  2. embulk gem install embulk-input-jdbc
  3. In this article, we use MySQL as the destination database. You can also choose SQL Server, PostgreSQL, or Google BigQuery as the destination using the output Plugins.
    https://github.com/embulk/embulk-output-jdbc/tree/master/embulk-output-mysql embulk gem install embulk-output-mysql

With the input and output plugins installed, we are ready to load IBM Cloud Object Storage data into MySQL using Embulk.

Create a Job to Load IBM Cloud Object Storage Data

Start by creating a config file in Embulk, using a name like ibmcloudobjectstorage-mysql.yml.

  1. For the input plugin options, use the CData JDBC Driver for IBM Cloud Object Storage, including the path to the driver JAR file, the driver class (e.g. cdata.jdbc.ibmcloudobjectstorage.IBMCloudObjectStorageDriver), and the JDBC URL from above
  2. For the output plugin options, use the values and credentials for the MySQL database

Sample Config File (ibmcloudobjectstorage-mysql.yml)

in: type: jdbc driver_path: C:\Program Files\CData\CData JDBC Driver for IBM Cloud Object Storage 20xx\lib\cdata.jdbc.ibmcloudobjectstorage.jar driver_class: cdata.jdbc.ibmcloudobjectstorage.IBMCloudObjectStorageDriver url: jdbc:ibmcloudobjectstorage:ApiKey=myApiKey;CloudObjectStorageCRN=MyInstanceCRN;Region=myRegion;OAuthClientId=MyOAuthClientId;OAuthClientSecret=myOAuthClientSecret; table: "Objects" out: type: mysql host: localhost database: DatabaseName user: UserId password: UserPassword table: "Objects" mode: insert

After creating the file, run the Embulk job.

embulk run ibmcloudobjectstorage-mysql.yml

After running the the Embulk job, find the Salesforce data in the MySQL table.

Load Filtered IBM Cloud Object Storage Data

In addition to loading data directly from a table, you can use a custom SQL query to have more granular control of the data loaded. You can also perform increment loads by setting a last updated column in a SQL WHERE clause in the query field.

in: type: jdbc driver_path: C:\Program Files\CData\CData JDBC Driver for IBM Cloud Object Storage 20xx\lib\cdata.jdbc.ibmcloudobjectstorage.jar driver_class: cdata.jdbc.ibmcloudobjectstorage.IBMCloudObjectStorageDriver url: jdbc:ibmcloudobjectstorage:ApiKey=myApiKey;CloudObjectStorageCRN=MyInstanceCRN;Region=myRegion;OAuthClientId=MyOAuthClientId;OAuthClientSecret=myOAuthClientSecret; query: "SELECT Key, Etag FROM Objects WHERE [RecordId] = 1" out: type: mysql host: localhost database: DatabaseName user: UserId password: UserPassword table: "Objects" mode: insert

More Information & Free Trial

By using CData JDBC Driver for IBM Cloud Object Storage as a connector, Embulk can integrate IBM Cloud Object Storage data into your data load jobs. And with drivers for more than 200+ other enterprise sources, you can integrate any enterprise SaaS, big data, or NoSQL source as well. Download a 30-day free trial and get started today.