今すぐお試しください!

製品の詳細CData JDBC Driver for FinancialForce を確認して、無償評価版をダウンロード:

今すぐダウンロード

JRuby からFinancialForce Data にデータ連携

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

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

FinancialForce Data にJDBC で接続

Before creating the app, note the installation location for the JAR file for the JDBC Driver (typically C:\Program Files\CDatat\CData JDBC Driver for FinancialForce\lib).

JRuby natively supports JDBC, so you can easily connect to FinancialForce 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 FinancialForce: 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 FinancialForce 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 FinancialForce.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 FinancialForce Sandbox Accounts

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

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

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

java -jar cdata.jdbc.financialforce.jar

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

Below is a typical JDBC connection string for FinancialForce:

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

FinancialForce Data への接続性を持つJRuby アプリを作成

Create a new Ruby file (for example: FinancialForceSelect.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 FinancialForce 2018/lib/cdata.jdbc.financialforce.jar' url = "jdbc:financialforce: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 FinancialForce data with JRuby.To do so, simply run your file from the command line:

jruby -S FinancialForceSelect.rb

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

 
 
ダウンロード