How to work with JD Edwards Data in Apache Spark using SQL

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Access and process JD Edwards Data in Apache Spark using the CData JDBC Driver.

Apache Spark is a fast and general engine for large-scale data processing. When paired with the CData JDBC Driver for JD Edwards, Spark can work with live JD Edwards data. This article describes how to connect to and query JD Edwards data from a Spark shell.

The CData JDBC Driver offers unmatched performance for interacting with live JD Edwards data due to optimized data processing built into the driver. When you issue complex SQL queries to JD Edwards, the driver pushes supported SQL operations, like filters and aggregations, directly to JD Edwards and utilizes the embedded SQL engine to process unsupported operations (often SQL functions and JOIN operations) client-side. With built-in dynamic metadata querying, you can work with and analyze JD Edwards data using native data types.

Install the CData JDBC Driver for JD Edwards

Download the CData JDBC Driver for JD Edwards installer, unzip the package, and run the JAR file to install the driver.

Start a Spark Shell and Connect to JD Edwards Data

  1. Open a terminal and start the Spark shell with the CData JDBC Driver for JD Edwards JAR file as the jars parameter:
    
    $ spark-shell --jars /CData/CData JDBC Driver for JD Edwards/lib/cdata.jdbc.jdedwards.jar
    
  2. With the shell running, you can connect to JD Edwards with a JDBC URL and use the SQL Context load() function to read a table.

    The driver connects to JD Edwards through your Application Interface Services (AIS) Server. Set the following connection properties:

    • URL: The base HTTPS URL of your AIS Server (e.g., https://jde-ais.example.com:8300).
    • User: Your JD Edwards username.
    • Password: Your JD Edwards password.
    • Environment (optional): The JD Edwards environment to use (e.g., PD920 for production or DV920 for development). If not specified, the AIS Server's default environment is used.
    • Role (optional): The JD Edwards role for the session. If not specified, the AIS Server's default role is used.
    • DeviceName (optional): An identifier for the connecting device or application, used for auditing and logging on the AIS Server.
    • Jasserver (optional): The specific Java Application Server (JAS) instance to route requests through, useful in clustered environments.

    Choosing Which Data Is Exposed

    JD Edwards organizes tables and business views by System Code, and the driver exposes each System Code as its own schema. Use these properties to control which schemas are available:

    • DataModel: One or more ERP modules (comma-separated) whose System Codes are exposed as schemas, or All to expose every System Code in the connected instance. Defaults to FinancialManagement.
    • SystemCodes: A comma-separated list of additional System Codes to expose alongside those from DataModel (e.g., 42,43).

    When you connect, the driver sends your credentials to the AIS Server to obtain a session token and caches it. The driver requests a new token automatically before the session expires.

    Built-in Connection String Designer

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

    
    java -jar cdata.jdbc.jdedwards.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.)

    Configure the connection to JD Edwards, using the connection string generated above.

    
    scala> val jdedwards_df = spark.sqlContext.read.format("jdbc").option("url", "jdbc:jdedwards:URL=https://your-jde-environment-app.example.com;User=admin;Password=myPassword;").option("dbtable","AccountsPayable.AccountLedger").option("driver","cdata.jdbc.jdedwards.JDEdwardsDriver").load()
    
  3. Once you connect and the data is loaded you will see the table schema displayed.
  4. Register the JD Edwards data as a temporary table:

    scala> jdedwards_df.registerTable("accountspayable.accountledger")
  5. Perform custom SQL queries against the Data using commands like the one below:

    scala> jdedwards_df.sqlContext.sql("SELECT DocumentNumber, Amount FROM AccountsPayable.AccountLedger WHERE BusinessUnit = 100").collect.foreach(println)

    You will see the results displayed in the console, similar to the following:

    Data in Apache Spark (Salesforce is shown)

Using the CData JDBC Driver for JD Edwards in Apache Spark, you are able to perform fast and complex analytics on JD Edwards data, combining the power and utility of Spark with your data. Download a free, 30 day trial of any of the hundreds of CData JDBC Drivers and get started today.

Ready to get started?

Download a free trial of the JD Edwards Driver to get started:

 Download Now

Learn more:

JD Edwards Icon JD Edwards JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with JD Edwards data including AccountLedger, ProposalofPayment, ContractRevenueSummary, EmployeeEnrollment, RentIncreaseAmounts, and more!