Connect to Act CRM Data in JRuby



Create a simple JRuby app with access to live Act CRM data.

JRuby is a high-performance, stable, fully threaded Java implementation of the Ruby programming language. The CData JDBC Driver for Act CRM makes it easy to integrate connectivity to live Act CRM data in JRuby. This article shows how to create a simple JRuby app that connects to Act CRM data, executes a query, and displays the results.

Configure a JDBC Connection to Act CRM Data

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 Act CRM\lib).

JRuby natively supports JDBC, so you can easily connect to Act CRM and execute SQL queries. Initialize the JDBC connection with the getConnection function of the java.sql.DriverManager class.

The User and Password properties, under the Authentication section, must be set to valid Act! user credentials. In addition to the authentication values, see the following:

  • Connecting to Act! Premium

    In addition to the authentication values, the URL to Act! is also required; for example https://eup1-iis-04.eu.hosted.act.com/.

    Additionally, you must specify the ActDatabase you will connect to. This is found by going to the About Act! Premium menu of your account, at the top right of the page, in the ? menu. Use the Database Name in the window that appears.

  • Connecting to Act! Premium Cloud

    To connect to your Act! Premium Cloud account, you also need to specify the ActCloudName property. This property is found in the URL address of the Cloud account; for example https://eup1-iis-04.eu.hosted.act.com/ActCloudName/.

Note that retrieving ActCRM metadata can be expensive. It is advised that you set the CacheMetadata property to store the metadata locally.

Built-in Connection String Designer

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

java -jar cdata.jdbc.actcrm.jar

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

Below is a typical JDBC connection string for Act CRM:

jdbc:actcrm:URL=https://myActCRMserver.com;User=myUser;Password=myPassword;ActDatabase=MyDB;

Create a JRuby App with Connectivity to Act CRM Data

Create a new Ruby file (for example: ActCRMSelect.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 Act CRM 2018/lib/cdata.jdbc.actcrm.jar' url = "jdbc:actcrm:URL=https://myActCRMserver.com;User=myUser;Password=myPassword;ActDatabase=MyDB;" conn = java.sql.DriverManager.getConnection(url) stmt = conn.createStatement rs = stmt.executeQuery("SELECT ActivityDisplayName, Subject FROM Activities") while (rs.next) do puts rs.getString(1) + ' ' + rs.getString(2) end

With the file completed, you are ready to display your Act CRM data with JRuby. To do so, simply run your file from the command line:

jruby -S ActCRMSelect.rb

Writing SQL-92 queries to Act CRM allows you to quickly and easily incorporate Act CRM data into your own JRuby applications. Download a free trial today!

Ready to get started?

Download a free trial of the Act CRM Driver to get started:

 Download Now

Learn more:

Act CRM Icon Act CRM JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Act CRM data including Companies, Contact, Groups, Opportunities, and more!