![]() |
VOOZH | about |
JRuby is a high-performance, stable, fully threaded Java implementation of the Ruby programming language. The CData JDBC Driver for Adobe Experience Manager makes it easy to integrate connectivity to live Adobe Experience Manager data in JRuby. This article shows how to create a simple JRuby app that connects to Adobe Experience Manager data, executes a query, and displays the results.
Before creating the app, note the installation location for the JAR file for the JDBC Driver (typically C:\Program Files\CData\CData JDBC Driver for Adobe Experience Manager\lib).
JRuby natively supports JDBC, so you can easily connect to Adobe Experience Manager and execute SQL queries. Initialize the JDBC connection with the getConnection function of the java.sql.DriverManager class.
The driver connects to Adobe Experience Manager (AEM) instances that expose the JCR repository over WebDAV. It supports both on-premises AEM and AEM as a Cloud Service deployments.
To establish a connection, set the following properties:
Note: Tables are dynamically generated based on the JCR repository structure. Ensure that the configured user has sufficient permissions to access the required content paths in the AEM repository.
For assistance in constructing the JDBC URL, use the connection string designer built into the Adobe Experience Manager JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.adobeexperiencemanager.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.)Below is a typical JDBC connection string for Adobe Experience Manager:
jdbc:adobeexperiencemanager:URL=https://author-p12345-e67890.adobeaemcloud.com/crx/server;User=admin;Password=admin;
Create a new Ruby file (for example: AdobeExperienceManagerSelect.rb) and open it in a text editor. Copy the following code into your file:
require 'java'
require 'rubygems'
require 'C:/Program Files/CData/CData JDBC Driver for Adobe Experience Manager 2018/lib/cdata.jdbc.adobeexperiencemanager.jar'
url = "jdbc:adobeexperiencemanager:URL=https://author-p12345-e67890.adobeaemcloud.com/crx/server;User=admin;Password=admin;"
conn = java.sql.DriverManager.getConnection(url)
stmt = conn.createStatement
rs = stmt.executeQuery("SELECT Id, Name FROM Content")
while (rs.next) do
puts rs.getString(1) + ' ' + rs.getString(2)
end
With the file completed, you are ready to display your Adobe Experience Manager data with JRuby. To do so, simply run your file from the command line:
jruby -S AdobeExperienceManagerSelect.rb
Writing SQL-92 queries to Adobe Experience Manager allows you to quickly and easily incorporate Adobe Experience Manager data into your own JRuby applications. Download a free trial today!
Download a free trial of the Adobe Experience Manager Driver to get started:
Download NowLearn more:
👁 Adobe Experience Manager IconRapidly create and deploy powerful Java applications that integrate with Adobe Experience Manager.