Ready to get started?

Download a free trial of the Certinia Driver to get started:

 Download Now

Learn more:

Certinia Icon Certinia JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Certinia.

Connect to Certinia Data in JRuby



Create a simple JRuby app with access to live Certinia data.

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

Configure a JDBC Connection to Certinia 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 Certinia\lib).

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

There are several authentication methods available for connecting to Certinia: login credentials, SSO, and OAuth.

Authenticating with a Login and Token

Set the User and Password to your login credentials. Additionally, set the SecurityToken. By default, the SecurityToken is required, but you can make it optional by allowing a range of trusted IP addresses.

To disable the security token:

  1. Log in to Certinia and enter "Network Access" in the Quick Find box in the setup section.
  2. Add your IP address to the list of trusted IP addresses.

To obtain the security token:

  1. Open the personal information page on certinia.com.
  2. Click the link to reset your security token. The token will be emailed to you.
  3. Specify the security token in the SecurityToken connection property or append it to the Password.

Authenticating with OAuth

If you do not have access to the user name and password or do not want to require them, use the OAuth user consent flow. See the OAuth section in the Help for an authentication guide.

Connecting to Certinia Sandbox Accounts

Set UseSandbox to true (false by default) to use a Certinia sandbox account. Ensure that you specify a sandbox user name in User.

Built-in Connection String Designer

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

java -jar cdata.jdbc.certinia.jar

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

Below is a typical JDBC connection string for Certinia:

jdbc:certinia:User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=GETANDREFRESH

Create a JRuby App with Connectivity to Certinia Data

Create a new Ruby file (for example: CertiniaSelect.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 Certinia 2018/lib/cdata.jdbc.certinia.jar' url = "jdbc:certinia:User=myUser;Password=myPassword;Security Token=myToken;InitiateOAuth=GETANDREFRESH" conn = java.sql.DriverManager.getConnection(url) stmt = conn.createStatement rs = stmt.executeQuery("SELECT BillingState, Name FROM Account") while (rs.next) do puts rs.getString(1) + ' ' + rs.getString(2) end

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

jruby -S CertiniaSelect.rb

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