Ready to get started?

Download a free trial of the Raisers Edge NXT Driver to get started:

 Download Now

Learn more:

Raisers Edge NXT Icon Raisers Edge NXT JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Raisers Edge NXT.

Create a Data Access Object for Raisers Edge NXT Data using JDBI



A brief overview of creating a SQL Object API for Raisers Edge NXT data in JDBI.

JDBI is a SQL convenience library for Java that exposes two different style APIs, a fluent style and a SQL object style. The CData JDBC Driver for Raisers Edge NXT integrates connectivity to live Raisers Edge NXT data in Java applications. By pairing these technologies, you gain simple, programmatic access to Raisers Edge NXT data. This article walks through building a basic Data Access Object (DAO) and the accompanying code to read Raisers Edge NXT data.

Create a DAO for the Raisers Edge NXT Constituents Entity

The interface below declares the desired behavior for the SQL object to create a single method for each SQL statement to be implemented.

public interface MyConstituentsDAO { //request specific data from Raisers Edge NXT (String type is used for simplicity) @SqlQuery("SELECT AddressLines FROM Constituents WHERE Type = :type") String findAddressLinesByType(@Bind("type") String type); /* * close with no args is used to close the connection */ void close(); }

Open a Connection to Raisers Edge NXT

Collect the necessary connection properties and construct the appropriate JDBC URL for connecting to Raisers Edge NXT.

Before establishing a connection, supply the SubscriptionKey, found in the Blackbaud Raiser's Edge NXT Profile.

Authenticating to Raiser's Edge NXT

Blackbaud Raiser's Edge NXT uses the OAuth authentication standard. You can connect to without setting any connection properties using the embedded OAuth credentials.

Alternatively, you can authenticate by creating a custom app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties.

See the Help documentation for an authentication guide.

Built-in Connection String Designer

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

java -jar cdata.jdbc.raiseredgenxt.jar

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

A connection string for Raisers Edge NXT will typically look like the following:

jdbc:raiseredgenxt:SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;InitiateOAuth=GETANDREFRESH

Use the configured JDBC URL to obtain an instance of the DAO interface. The particular method shown below will open a handle bound to the instance, so the instance needs to be closed explicitly to release the handle and the bound JDBC connection.

DBI dbi = new DBI("jdbc:raiseredgenxt:SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;InitiateOAuth=GETANDREFRESH"); MyConstituentsDAO dao = dbi.open(MyConstituentsDAO.class); //do stuff with the DAO dao.close();

Read Raisers Edge NXT Data

With the connection open to Raisers Edge NXT, simply call the previously defined method to retrieve data from the Constituents entity in Raisers Edge NXT.

//disply the result of our 'find' method String addressLines = dao.findAddressLinesByType("Home"); System.out.println(addressLines);

Since the JDBI library is able to work with JDBC connections, you can easily produce a SQL Object API for Raisers Edge NXT by integrating with the CData JDBC Driver for Raisers Edge NXT. Download a free trial and work with live Raisers Edge NXT data in custom Java applications today.