IBM WebSphere is a powerful application server that runs many enterprise level Java applications and services. When paired with the CData JDBC Driver for IBM Cloud Object Storage, IBM WebSphere applications can connect to IBM Cloud Object Storage and work with data using standard SQL queries instead of complex APIs. This simplifies integration, reduces development effort, and provides secure, real-time access to critical business data.
Prerequisites
- Access to a IBM Cloud Object Storage account (with API permissions)
- IBM WebSphere Application Server (configured and running)
- CData JDBC Driver for IBM Cloud Object Storage
- Java Servlet WAR application ready for deployment
Note: This article uses Salesforce as a demonstration data source, but the same steps can be followed to connect to any of the 250+ JDBC Drivers available in our portfolio.
Getting Started
Step 1: Download and install the CData JDBC Driver for IBM Cloud Object Storage
Download and install the CData JDBC Driver for IBM Cloud Object Storage, which provides a .jar file: cdata.jdbc.ibmcloudobjectstorage.jar
Step 2: Install and configure IBM Websphere
-
Create an account in IBM WebSphere using the official IBM site.
-
Install and configure the IBM Websphere Application server in the local system using the documentation:
IBM Websphere Application Server
-
Once the application server is installed, start the WebSphere Server using the Admin Console in your browser: https://your-server:9043/ibm/console
π Login to Websphere admin console
Step 3: Set up the JDBC provider and data source for IBM Cloud Object Storage
- Go to Resources, expand the JDBC section, and then select JDBC providers to create a new provider
π Create new JDBC providers
- Select the appropriate scope from the drop down menu
π Select the scopes
- Click New to add a JDBC provider
-
Choose User defined as the database type
- Enter cdata.jdbc.ibmcloudobjectstorage.IBMCloudObjectStorageConnectionPoolDataSource as the implementation class name
- Type a name for the provider, for example User defined JDBC Provider
- Enter the full path of the JDBC driver JAR file in the classpath field
- Click Next, then Finish, and save the changes to the master configuration.
π Creating JDBC Provider
- Once the JDBC provider is created, add a JDBC data source.
-
Enter the basic details such as Data Source Name and JNDI name
-
Select the existing JDBC provider created earlier (e.g., CData IBM Cloud Object Storage Provider)
-
Provide the Implementation class name: cdata.jdbc.ibmcloudobjectstorage.IBMCloudObjectStorageConnectionPoolDataSource
-
Add the Data Store Helper Class Name: com.ibm.websphere.rsadapter.GenericDataStoreHelper
-
Configure security by setting authentication aliases if required
-
Review the Summary page to verify all details and click Finish to complete the data source creation
π Adding JDBC data source
-
Select the newly created data source from the list and open Custom properties
-
Add the JDBC connection string under the URL property and press OK. For example:
jdbc:ibmcloudobjectstorage:RTK=5246...;ApiKey=myApiKey;CloudObjectStorageCRN=MyInstanceCRN;Region=myRegion;OAuthClientId=MyOAuthClientId;OAuthClientSecret=myOAuthClientSecret;
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
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, 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.
π Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)
Note: If the URL property is not available, create it and then add the JDBC connection string.
Tip: Always test the connection string with the driver before entering it in the URL property.
π Adding JDBC data source
- Now open the data source and choose Test Connection
π Testing the connection
Step 4: Build the web application
- Build the web application using preferred Java framework (Servlet, JSP, or Spring). The resulting .war file will typically follow a structure like this:
IBM Cloud Object StorageServletApp.war
|--webcontent
| |--index.jsp -- JSP page (entry point)
| |
| |--WEB-INF/ --Hidden from direct browser access
| |--web.xml -- Deployment descriptor
| |
| |--classes/ --Compiled .class files
| |--com/example/IBM Cloud Object Storage/
| |--IBM Cloud Object StorageServlet.class
|
|--lib/ --Dependency JARs
|--cdata.jdbc.ibmcloudobjectstorage.jar
- Define the data access logic using JDBC or JPA, referencing the data source through a JNDI name
- This article explains how to set up a JDBC connection and deploy a Java Servlet application
- Package the project as a WAR (Web Application Archive) or EAR (Enterprise Archive) file for deployment
Step 5: Deploy the IBM Cloud Object Storage application in WebSphere
-
In the WebSphere admin console, go to Applications and select Install New Application
- Browse and upload the WAR file, then continue with the installation wizard.
Step 6: Retrieve IBM Cloud Object Storage data through WebSphere
-
Access the application using its context root: http://hostname:port/context-root/page
π Demo application
Note: Ensure the deployed application is started before opening it in the browser.
π Data is retrieved
We can now view the retrieved data from the source. The data is accessible directly through IBM WebSphere. This setup demonstrates how a servlet can be deployed in WebSphere to retrieve IBM Cloud Object Storage data using the JDBC driver, creating a strong foundation for building advanced IBM Cloud Object Storage powered enterprise applications.
Get Started with Connecting IBM Cloud Object Storage to IBM WebSphere
Start connecting IBM Cloud Object Storage to IBM WebSphere with the CData JDBC Connector today. Download the free 30-day trial and explore how easy it is to enable secure, real-time data access for your applications. As always, our world-class Support Team is available to help with any questions you may have.