We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →Build Apps with Live IBM Cloud Object Storage Data Using the Low-Code Development Platform of Mendix
Connect IBM Cloud Object Storage data with Mendix to build apps using the CData JDBC Driver for IBM Cloud Object Storage.
Mendix, developed by Siemens, is a low-code platform used to rapidly develop, test, and deploy web and mobile applications, facilitating digital transformation and enhancing business agility. When paired with the CData JDBC Driver for IBM Cloud Object Storage, you can use your IBM Cloud Object Storage data to create various applications using Mendix Studio Pro.
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). Its built-in dynamic metadata querying allows you to work with and analyze IBM Cloud Object Storage data using native data types.
This article shows how you can easily create an application that utilizes IBM Cloud Object Storage data in Mendix by combining the JDBC interface provided by Mendix with the CData JDBC Driver for IBM Cloud Object Storage.
Preparing the Mendix environment
In this section, we will explore how to develop an app using Mendix Studio Pro, as previously introduced, with IBM Cloud Object Storage data. Be sure to install Mendix Studio Pro beforehand.
Install the CData JDBC Driver for IBM Cloud Object Storage
First, install the CData JDBC Driver for IBM Cloud Object Storage on the same machine as Mendix. The JDBC Driver will be installed in the following path:
C:\Program Files\CData\CData JDBC Driver for IBM Cloud Object Storage 20xx\lib\cdata.jdbc.ibmcloudobjectstorage.jar
Create an application
Now let's start creating the app. First, let's make an app that has the Database Connector available.
- Launch Mendix Studio Pro and click 'Create New App.'
- Select the 'Blank Web App' option.
- Click 'Use this starting point' to proceed.
- Create an app with a name of your choice. Also, note down the "Disk location" information, for future reference.
- You have now created a brand-new app.
Add the Database Connector to your application
Next, add the Database Connector module to the app you just created.
- On the top right, click on the Marketplace button.
- Search for Database Connector in the Marketplace search section and select it.
- Click on Download to download the latest Database Connector.
- In the Import Module window, select the Action as Add as a new module.
- If the Database Connector appears on the app screen, you are good to move on to the next steps.
Adding the JDBC Driver to Mendix Studio Pro
To use the CData JDBC driver with this Database Connector, you must add the JDBC Driver JAR file to your project.
- In the Mendix project folder you noted earlier, there is a folder named 'userlib.' Place the two files, 'cdata.jdbc.ibmcloudobjectstorage.jar' and 'cdata.jdbc.ibmcloudobjectstorage.lic,' into that folder.
- You can now use the CData JDBC Driver with the Database Connector.
Create a Data Model
Now, let's create an app. We first need to define a data model to load data from the Database Connector and display it on the list screen. Let's create the data model before loading the data.
- Add an Entity to the 'Domain model' of MyFirstModule.
- Enter the entity name and field definitions.
- You can easily configure the data by checking the table definition information through the CData JDBC driver using a tool such as DBeaver.
- Define the entities.
Create a constant for the JDBC URL
Next, create a JDBC URL constant to use with the Database Connector.
- Add 'Constant' to MyFirstModule.
- Add a name to the Constant in the Add Constant window.
Generate a JDBC URL for connecting to IBM Cloud Object Storage, beginning with jdbc:ibmcloudobjectstorage: followed by a series of semicolon-separated connection string properties.
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:
- Log in to your IBM Cloud account.
- 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:
- Log in to your IBM Cloud account.
- Navigate to the Platform API Keys page.
- On the middle-right corner click "Create an IBM Cloud API Key" to create a new API Key.
- 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.
- Extracts the access token and authenticates requests.
- 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.
A typical JDBC URL is below:
jdbc:ibmcloudobjectstorage:ApiKey=myApiKey;CloudObjectStorageCRN=MyInstanceCRN;Region=myRegion;OAuthClientId=MyOAuthClientId;OAuthClientSecret=myOAuthClientSecret;
- Specify the connection string copied from the previous step in the Default value section and click on OK.
Create a microflow to retrieve IBM Cloud Object Storage data
Let's create a microflow that retrieves data from the Database Connector based on the entity we created.
- Click 'Add microflow' from MyFirstModule.
- Create a microflow with any name.
- First, create an object for the entity you defined earlier. Then, add the 'Create Object' action to the microflow.
- Click on the 'Select' button for Entity in the Create Object window.
- Select a previously defined Entity.
- Enter an arbitrary Object name and click OK.
- Next, add an Execute Query action to the microflow to retrieve data from the Database Connector.
- Define each input in the Execute Query window.
- In "jdbc url", specify the constant you defined beforehand.
- In SQL, write a query to retrieve data from IBM Cloud Object Storage.
- You don't need a Username or Password this time, so set them to 'empty' and assign the object created in the previous flow as the Result object. Then, simply specify any name you prefer for the List in the List Name section.
- Finally, define the output of the microflow.
- Double-click the End Event to open it, select 'List' from the Type dropdown, and link it to the Entity you defined earlier. Then, set the output result of Execute Query as the Return value.
- This completes the microflow that retrieves data from IBM Cloud Object Storage.
Create a list screen and link it to a microflow
Finally, let's create a screen that displays the results obtained from the microflow.
- Double-click 'Home_web' inside the Toolbox menu to open it.
- Drag and drop a Data grid template from the Data containers section into the list screen.
- Once you have placed the Data grid, double-click on it to display the Edit Data Grid settings screen.
- Navigate to the Data source tab and link the data source type with the Microflow.
- Select the microflow you just created.
- Now click OK.
- When you click OK, you'll be prompted to auto-detect columns. Simply click 'Yes' to proceed.
- Next, you'll be prompted to generate controllers for various Data grids. Since we won't be configuring the logic for each one this time, click 'No.'
- This will create a simple data grid screen as shown below.
Try it out
Now let's check if it works properly.
- Click the 'Publish' button to prepare the app you created. Once that's done, click 'View App' to open the app.
- If you see a list of IBM Cloud Object Storage data like the one below, you're all set! You've successfully created a IBM Cloud Object Storage-linked app with low code, without needing to worry about IBM Cloud Object Storage's API.
Get Started Today
Download a free 30-day trial of the CData JDBC Driver for IBM Cloud Object Storage with Mendix, and effortlessly create an app that connects to IBM Cloud Object Storage data.
Reach out to our Support Team if you have any questions.