Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Red Hat JBoss Data Virtualization on OpenShift: Part 4 - Bringing data from outside to inside the PaaS

January 26, 2017
Cojan van Ballegooijen
Related topics:
Artificial intelligenceContainersKubernetes
Related products:
Red Hat JBoss Enterprise Application PlatformRed Hat OpenShift Container Platform

    Welcome to part 4 of Red Hat JBoss Data Virtualization (JDV) running on OpenShift.

    JDV is a lean, virtual data integration solution that unlocks trapped data and delivers it as easily consumable, unified, and actionable information. JDV makes data spread across physically diverse systems such as multiple databases, XML files, and Hadoop systems appear as a set of tables in a local database.

    When deployed on OpenShift, JDV enables:

    1. Service enabling your data.
    2. Bringing data from outside to inside the PaaS.
    3. Breaking up monolithic data sources virtually for a microservices architecture.

    Together with the JDV for OpenShift image, we have made available several OpenShift templates that allow you to test and bootstrap JDV.

    Introduction

    In part 1, part 2, and part 3 we described how to get started with JDV running on OpenShift, service enable your data using OData, and how to perform data federation from internal datasources with PostgreSQL and MySQL. We are now adding an external datasource (Oracle database) bringing data from outside to inside the PaaS.

    The tasks needed to achieve bringing data from outside to inside the PaaS are depicted in the image below.

    Environment

    In this example, we are using an Oracle XE database running inside a VirtualBox environment. The environment is depicted in the following diagram.

     

    Create OpenShift template

    The OpenShift template (datavirt63-ext-mysql-psql-s2i.json) we were using in part 2 contains the JDV environment with internal data sources only (MySQL and PostgreSQL). To configure an external Oracle database we’re going to remove the MySQL configuration and use a new OpenShift template (datavirt63-ext-oracle-psql-s2i.json) based on the previous template but now includes configuration of an external Oracle database environment and add it to our OpenShift environment as described below.

    $ vagrant ssh
    [vagrant@rhel-cdk ~]$ oc login -u admin -p admin
    Login successful.
    
    You have access to the following projects and can switch between them with 'oc project <projectname>':
    
     * default (current)
     * openshift
     * openshift-infra
    [vagrant@rhel-cdk ~]$ oc project openshift
    Now using project "openshift" on server "https://127.0.0.1:8443".
    [vagrant@rhel-cdk ~]$ oc create -f https://raw.githubusercontent.com/cvanball/jdv-ose-demo/master/extensions/is.json 
    [vagrant@rhel-cdk ~]$ oc create -n openshift -f https://raw.githubusercontent.com/cvanball/jdv-ose-demos/master/templates/datavirt63-ext-oracle-psql-s2i.json

    Configure external data source

    Files for runtime artifacts are passed to the JDV for OpenShift image using the OpenShift secrets mechanism. This includes the environment files for the datasources and resource adapters, as well as any additional data files. These files need to be present locally so we are able to create OpenShift secrets for them.

    There are two types of datasources:

    1. Internal datasources supported by Red Hat JBoss Middleware for OpenShift. These are PostgreSQL, MySQL, and MongoDB. Internal datasources do not require additional environment files to be configured.
    2. External datasources that do are not supported by default by OpenShift. The configuration of external datasources is provided by environment files added to OpenShift Secrets.

    Since we are now using an external datasource using an Oracle Database, we have to configure the external datasources in the datasources.properties file, configure the install.properties for the Oracle driver and the JBoss module for Oracle.

    1. Configure install.sh to include the modules for the external data source.
      #!/bin/bash
      
      set -x
      
      source /usr/local/s2i/install-common.sh
      
      injected_dir=$1
      
      chmod -R ugo+rX ${injected_dir}/modules
      install_modules ${injected_dir}/modules
      
      configure_drivers ${injected_dir}/install.properties
      
      #configure_translators ${injected_dir}/install.properties
    2. Configure install.properties to install Oracle driver as shown below.
      #DRIVERS
      DRIVERS=ORACLE_DRIVER
      
      ORACLE_DRIVER_DRIVER_NAME=oracle
      ORACLE_DRIVER_DRIVER_MODULE=com.oracle
      ORACLE_DRIVER_DRIVER_CLASS=oracle.jdbc.OracleDriver
      ORACLE_DRIVER_XA_DATASOURCE_CLASS=oracle.jdbc.xa.client.OracleXADataSource
      
      
      #TRANSLATORS
    3. Create a JBoss module.
      A JBoss module is a logical grouping of classes used for class loading and dependency management. JBoss modules are defined in the EAP_HOME/modules/ directory of the application server. Each JBoss module exists as a subdirectory, for example, EAP_HOME/modules/com/oracle/. Each module directory then contains a slot subdirectory, which defaults to main and contains the module.xml (see below) configuration file and any required JAR files, in this case, ojdbc6.jar.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.3" name="com.oracle">
       <resources>
         <resource-root path="ojdbc6.jar"/>
       </resources>
      
       <dependencies>
         <module name="javax.api"/>
         <module name="javax.resource.api"/>
         <module name="javax.transaction.api"/>
       </dependencies>
      </module>
    4. Download JDBC driver for the external data source. In this case, we need to download the Oracle JDBC driver here. and place the ojdbc6.jar in <DIR>/jdv-ose-demos/bringing-data-to-the-paas/oracle-postgresql-driver-image/modules/system/layers/openshift/com/oracle/main
    5. Configure data source configuration in datasources.properties to include the external data source as shown below.
      #Configure datasources
      
      #DATASOURCES
      DATASOURCES=EUCUSTOMERS,USCUSTOMERS
      
      USCUSTOMERS_JNDI=java:jboss/datasources/USCustomersDS
      USCUSTOMERS_DRIVER=postgresql
      USCUSTOMERS_NONXA=true
      USCUSTOMERS_USERNAME=jdv
      USCUSTOMERS_PASSWORD=redhat1!
      USCUSTOMERS_DATABASE=uscustomers
      USCUSTOMERS_PROTOCOL=jdbc:postgresql
      USCUSTOMERS_MIN_POOL_SIZE=5
      USCUSTOMERS_MAX_POOL_SIZE=10
      USCUSTOMERS_JTA=true
      USCUSTOMERS_VALIDATE=true
      
      EUCUSTOMERS_JNDI=java:jboss/datasources/EUCustomersDS
      EUCUSTOMERS_DRIVER=oracle
      EUCUSTOMERS_NONXA=false
      EUCUSTOMERS_USERNAME=jdv
      EUCUSTOMERS_PASSWORD=redhat1!
      EUCUSTOMERS_DATABASE=XE
      EUCUSTOMERS_PROTOCOL=jdbc:oracle:thin
      EUCUSTOMERS_SERVICE_HOST=192.168.99.100
      EUCUSTOMERS_SERVICE_PORT=1521
      EUCUSTOMERS_XA_CONNECTION_PROPERTY_URL=jdbc:oracle:thin:@192.168.99.100:1521:XE
      EUCUSTOMERS_MIN_POOL_SIZE=5
      EUCUSTOMERS_MAX_POOL_SIZE=10
      EUCUSTOMERS_JTA=true
      EUCUSTOMERS_VALIDATE=true
      EUCUSTOMERS_CONNECTION_CHECKER=org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker
      EUCUSTOMERS_EXCEPTION_SORTER=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter

      Note: All the steps above are automated with the exception of
      - download the ojdbc6.jar and put it into <DIR>/jdv-ose-demos/bringing-data-to-the-paas/oracle-postgresql-driver-image/modules/system/layers/openshift/com/oracle/main
      - create an Oracle user called jdv with password redhat1! and run the eucustomers-oracle.sql to create the required tables and data
      - change the Oracle data source settings applicable to your Oracle environment

    $ oc login -u openshift-dev -p devel
    $ oc new-project jdv-bring-data-into-the-paas-demo
    $ oc create -f https://raw.githubusercontent.com/cvanball/jdv-ose-demos/master/bringing-data-to-the-paas/oracle-postgresql-driver-image/datavirt-app-secret.yaml
    $ oadm policy add-role-to-user view system:serviceaccount:jdv-bring-data-into-the-paas-demo:datavirt-service-account
    $ curl https://raw.githubusercontent.com/cvanball/jdv-ose-demos/master/bringing-data-to-the-paas/oracle-postgresql-driver-image/datasources.properties -o datasources.properties
    $ oc secrets new datavirt-app-config datasources.properties

    Build and deploy container

    Log into the OpenShift web console with username “openshift-dev” and password “devel”.

    Now we need to attach the new OpenShift template to our project.
    You should see project jdv-bring-data-into-the-paas-demo in the project list.

    Click on project jdv-bring-data-into-the-paas-demo.

    Click the Add to project button and search for template oracle.

    Now you should get a template in category xPaas in the search results, select the
    datavirt63-ext-oracle-psql-s2i template.

    Since we have configured the template datavirt63-ext-oracle-psql-s2i, there's no need to change any of the template variables. We can now proceed by clicking the Create button to start the build and deployment process of the PostgreSQL and JDV pods.

    The PostgreSQL pod will be created first, JDV will then be built and deployed. If the build and deployment are successful, you should see similar results as depicted in the image below.

    Access the federated view model, All_Customers.CUSTOMER by using OData.
    After a successful build and deployment, we can now access the federated view model, All_Customers.CUSTOMER by using the following OData url:

    http://datavirt-app-jdv-bring-data-into-the-paas-demo.rhel-cdk.10.1.2.2.xip.io/odata4/Financials/All_Customers/CUSTOMER?$format=json

    For your convenience, we provide a shell script called jdv-ocp-setup.sh,  to run the above setup completely from the command line.

    Conclusion

    In just a few clicks, we created a new OpenShift project, added a JDV and PostgreSQL database environment, and connected to an external Oracle datasource using a ready to go OpenShift template. We populated the two databases with schemas, tables, and customer data. The Financials VDB were deployed bringing customer data from outside to inside the PaaS and access the federated model, All_Customers.CUSTOMER, using OData-based REST provided out-of-the-box service by running JDV on OpenShift.

    Resources

    • Red Hat JBoss Data Virtualization on OpenShift: Part 1 – Getting started
      https://developers.redhat.com/blog/2016/12/06/red-hat-jboss-data-virtualization-on-openshift-part-1-getting-started/
    • Red Hat JBoss Data Virtualization on OpenShift: Part 2 – Service enable your data
      https://developers.redhat.com/blog/2016/12/07/red-hat-jboss-data-virtualization-on-openshift-part-2-service-enable-your-data/
    • Red Hat JBoss Data Virtualization on OpenShift: Part 3 – Data federation
      https://developers.redhat.com/blog/2016/12/14/red-hat-jboss-data-virtualization-on-openshift-part-3-data-federation/
    • JDV Workshop
      https://github.com/DataVirtualizationByExample/DVWorkshop
    • OData
      http://www.odata.org
    • PostgreSQL
      https://www.postgresql.org/
    • Oracle
      http://www.oracle.com

       


      You can get additional information at Red Hat JBoss Data Virtualization, a data supply, and integration solution.

    Last updated: October 26, 2023

    Recent Posts

    • Installing Red Hat Enterprise Linux 10 from a bootc image with bootc

    • Why your database benchmarking data is probably wrong (and how I fixed mine)

    • Type what you want to break: AI-assisted chaos engineering with Krkn

    • Understanding evaluation collections in EvalHub

    • An overview of confidential containers on OpenShift bare metal

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.