製品をチェック

無償トライアル:

無償トライアルへ

製品の情報と無償トライアルへ:

ADP JDBC Driver

ADP 連携のパワフルなJava アプリケーションを素早く作成して配布。

データ連携でお困りですか?

お問い合わせ

JRuby からADP にデータ連携


リアルタイムADP に連携するシンプルなJRuby アプリケーションを作成します。


adp ロゴ画像
jdbc ロゴ画像

JDBC

JRuby ロゴ画像

JRuby はRuby プログラミング言語の高性能で安定した、完全にスレッド化されたJava 実装です。CData JDBC Driver for ADP を使用すると、JRuby からリアルタイムADP へのデータ連携を簡単に実装できます。ここでは、ADP に接続し、クエリを実行して結果を表示する簡単なJRuby アプリを作成する方法を説明します。

ADP データにJDBC で接続

アプリを作成する前に、JDBC Driver のJAR ファイルのインストール場所をメモします。 (通常はC:\Program Files\CDatat\CData JDBC Driver for ADP\libにあります。)

JRuby は、JDBC をネイティブにサポートしているため、簡単にADP に接続してSQL クエリを実行できます。java.sql.DriverManager クラスのgetConnection 関数を使用してJDBC 接続を初期化します。

Connect to ADP by specifying the following properties:

  • SSLClientCert: Set this to the certificate provided during registration.
  • SSLClientCertPassword: Set this to the password of the certificate.
  • UseUAT: The connector makes requests to the production environment by default. If using a developer account, set UseUAT = true.
  • RowScanDepth: The maximum number of rows to scan for the custom fields columns available in the table. The default value will be set to 100. Setting a high value may decrease performance.

The connector uses OAuth to authenticate with ADP. OAuth requires the authenticating user to interact with ADP using the browser. For more information, refer to the OAuth section in the Help documentation.

ビルトイン接続文字列デザイナー

JDBC URL の構成については、ADP JDBC Driver に組み込まれている接続文字列デザイナーを使用してください。JAR ファイルのダブルクリック、またはコマンドラインからJAR ファイルを実行します。

java -jar cdata.jdbc.adp.jar

接続プロパティを入力し、接続文字列をクリップボードにコピーします。

Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)

以下はADP の一般的なJDBC 接続文字列です。

jdbc:adp:OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;SSLClientCert='c:\cert.pfx';SSLClientCertPassword='admin@123'InitiateOAuth=GETANDREFRESH

ADP データへの接続性を持つJRuby アプリを作成

新しいRuby ファイル(例: ADPSelect.rb) を作成してテキストエディタで開き、次のコードをファイルにコピーします。

require 'java' require 'rubygems' require 'C:/Program Files/CData/CData JDBC Driver for ADP 2018/lib/cdata.jdbc.adp.jar' url = "jdbc:adp:OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;SSLClientCert='c:\cert.pfx';SSLClientCertPassword='admin@123'InitiateOAuth=GETANDREFRESH" conn = java.sql.DriverManager.getConnection(url) stmt = conn.createStatement rs = stmt.executeQuery("SELECT AssociateOID, WorkerID FROM Workers") while (rs.next) do puts rs.getString(1) + ' ' + rs.getString(2) end

ファイルが完成したら、コマンドラインからファイルを実行するだけでJRuby でADP を表示できるようになります。

jruby -S ADPSelect.rb

SQL-92 クエリをADP に書き込むと、ADP を独自のJRuby アプリケーションに素早く簡単に組み込むことができます。今すぐ無料トライアルをダウンロードしましょう。