Connect CSV to IBM WebSphere Using the CData JDBC Driver

Anusha M B
Anusha M B
Technical Marketing Engineer
Use the CData JDBC Driver to connect CSV with IBM WebSphere for seamless data integration and connectivity.

IBM WebSphere is a powerful application server that runs many enterprise level Java applications and services. When paired with the CData JDBC Driver for CSV, IBM WebSphere applications can connect to CSV 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

  1. Access to a CSV account (with API permissions)
  2. IBM WebSphere Application Server (configured and running)
  3. CData JDBC Driver for CSV
  4. 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 CSV

Download and install the CData JDBC Driver for CSV, which provides a .jar file: cdata.jdbc.csv.jar

Step 2: Install and configure IBM Websphere

  1. Create an account in IBM WebSphere using the official IBM site.
  2. Install and configure the IBM Websphere Application server in the local system using the documentation: IBM Websphere Application Server
  3. Once the application server is installed, start the WebSphere Server using the Admin Console in your browser: https://your-server:9043/ibm/console

Step 3: Set up the JDBC provider and data source for CSV

  1. Go to Resources, expand the JDBC section, and then select JDBC providers to create a new provider
  2. Select the appropriate scope from the drop down menu
  3. Click New to add a JDBC provider
    • Choose User defined as the database type
    • Enter cdata.jdbc.csv.CSVConnectionPoolDataSource 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.
  4. 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 CSV Provider)
    • Provide the Implementation class name: cdata.jdbc.csv.CSVConnectionPoolDataSource
    • 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
  5. Select the newly created data source from the list and open Custom properties
  6. Add the JDBC connection string under the URL property and press OK. For example:

    jdbc:csv:RTK=5246...;URI=/PATH/TO/MyCSVFilesFolder;

    Connecting to Local or Cloud-Stored (Box, Google Drive, Amazon S3, SharePoint) CSV Files

    CData Drivers let you work with CSV files stored locally and stored in cloud storage services like Box, Amazon S3, Google Drive, or SharePoint, right where they are.

    Setting connection properties for local files

    Set the URI property to local folder path.

    Setting connection properties for files stored in Amazon S3

    To connect to CSV file(s) within Amazon S3, set the URI property to the URI of the Bucket and Folder where the intended CSV files exist. In addition, at least set these properties:

    • AWSAccessKey: AWS Access Key (username)
    • AWSSecretKey: AWS Secret Key

    Setting connection properties for files stored in Box

    To connect to CSV file(s) within Box, set the URI property to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect to Box.

    Dropbox

    To connect to CSV file(s) within Dropbox, set the URI proprerty to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect to Dropbox. Either User Account or Service Account can be used to authenticate.

    SharePoint Online (SOAP)

    To connect to CSV file(s) within SharePoint with SOAP Schema, set the URI proprerty to the URI of the document library that includes the intended CSV file. Set User, Password, and StorageBaseURL.

    SharePoint Online REST

    To connect to CSV file(s) within SharePoint with REST Schema, set the URI proprerty to the URI of the document library that includes the intended CSV file. StorageBaseURL is optional. If not set, the driver will use the root drive. OAuth is used to authenticate.

    Google Drive

    To connect to CSV file(s) within Google Drive, set the URI property to the URI of the folder that includes the intended CSV file(s). Use the OAuth authentication method to connect and set InitiateOAuth to GETANDREFRESH.

    Built-in Connection String Designer

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

          java -jar cdata.jdbc.csv.jar
          

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

    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.
  7. Now open the data source and choose Test Connection

Step 4: Build the web application

  1. Build the web application using preferred Java framework (Servlet, JSP, or Spring). The resulting .war file will typically follow a structure like this:
  2. 		CSVServletApp.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/CSV/
    		|          |--CSVServlet.class
    		|
    		|--lib/                      --Dependency JARs
    		|--cdata.jdbc.csv.jar
    	
  3. Define the data access logic using JDBC or JPA, referencing the data source through a JNDI name
  4. This article walks through JDBC connection setup and deploying a Java Servlet application
  5. Package the project as a WAR (Web Application Archive) or EAR (Enterprise Archive) file for deployment
    • In a terminal compile the java file using the command:
      			cd webcontent
      			jar cvf ..\CSVServletApp.war *
      		

Step 5: Deploy the CSV application in WebSphere

  1. In the WebSphere admin console, go to Applications and select Install New Application
  2. Browse and upload the WAR file, then continue with the installation wizard.

Step 6: Retrieve CSV data through WebSphere

  1. Access the application using its context root: http://hostname:port/context-root/page
  2. Note: Ensure the deployed application is started before opening it in the browser.

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 CSV data using the JDBC driver, creating a strong foundation for building advanced CSV powered enterprise applications.

Get Started with Connecting CSV to IBM WebSphere

Start connecting CSV 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.

Ready to get started?

Download a free trial of the CSV Driver to get started:

 Download Now

Learn more:

CSV/TSV Files Icon CSV JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with delimited flat-file (CSV/TSV) data.