![]() |
VOOZH | about |
Apache Spark is a fast and general engine for large-scale data processing. When paired with the CData JDBC Driver for Sage 300, Spark can work with live Sage 300 data. This article describes how to connect to and query Sage 300 data from a Spark shell.
The CData JDBC Driver offers unmatched performance for interacting with live Sage 300 data due to optimized data processing built into the driver. When you issue complex SQL queries to Sage 300, the driver pushes supported SQL operations, like filters and aggregations, directly to Sage 300 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 Sage 300 data using native data types.
Download the CData JDBC Driver for Sage 300 installer, unzip the package, and run the JAR file to install the driver.
$ spark-shell --jars /CData/CData JDBC Driver for Sage 300/lib/cdata.jdbc.sage300.jar
Sage 300 requires some initial setup in order to communicate over the Sage 300 Web API.
Authenticate to Sage 300 using Basic authentication.
You must provide values for the following properties to successfully authenticate to Sage 300. Note that the provider reuses the session opened by Sage 300 using cookies. This means that your credentials are used only on the first request to open the session. After that, cookies returned from Sage 300 are used for authentication.
For assistance in constructing the JDBC URL, use the connection string designer built into the Sage 300 JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.sage300.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 Sage 300, using the connection string generated above.
scala> val sage300_df = spark.sqlContext.read.format("jdbc").option("url", "jdbc:sage300:User=SAMPLE;Password=password;URL=http://127.0.0.1/Sage300WebApi/v1/-/;Company=SAMINC;").option("dbtable","OEInvoices").option("driver","cdata.jdbc.sage300.Sage300Driver").load()
Register the Sage 300 data as a temporary table:
scala> sage300_df.registerTable("oeinvoices")
Perform custom SQL queries against the Data using commands like the one below:
scala> sage300_df.sqlContext.sql("SELECT InvoiceUniquifier, ApprovedLimit FROM OEInvoices WHERE AllowPartialShipments = Yes").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 Sage 300 in Apache Spark, you are able to perform fast and complex analytics on Sage 300 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.
Download a free trial of the Sage 300 Driver to get started:
Download NowLearn more:
👁 Sage 300 IconRapidly create and deploy powerful Java applications that integrate with Sage 300.