今すぐお試しください!

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

今すぐダウンロード

JDBI からXero WorkflowMax Data のデータアクセスオブジェクトを作成

JDBI でXero WorkflowMax data 用のSQL オブジェクトAPIを作成する方法を概説します。

JDBI は、Fluent スタイルとSQL オブジェクトスタイルという2つの異なるスタイルAPI を公開する、Java 用のSQL コンビニエンスライブラリです。CData JDBC Driver for Xero WorkflowMax は、Java アプリケーションとリアルタイムXero WorkflowMax data のデータ連携を実現します。これらの技術を組み合わせることによって、Xero WorkflowMax data へのシンプルなコードアクセスが可能になります。ここでは、基本的なDAO(Data Access Object )とそれに付随するXero WorkflowMax data の読み書きのためのコードの作成について説明します。

Xero WorkflowMax Clients Entity のDAO を作成

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 MyClientsDAO { //insert new data into Xero WorkflowMax @SqlUpdate("INSERT INTO Clients (Name, Name) values (:name, :name)") void insert(@Bind("name") String name, @Bind("name") String name); //request specific data from Xero WorkflowMax (String type is used for simplicity) @SqlQuery("SELECT Name FROM Clients WHERE Name = :name") String findNameByName(@Bind("name") String name); /* * close with no args is used to close the connection */ void close(); }

Xero WorkflowMax への接続を開く

Collect the necessary connection properties and construct the appropriate JDBC URL for connecting to Xero WorkflowMax.

To connect to the WorkflowMax API, obtain an APIKey and AccountKey from Xero. This can only be done by contacting Xero support (https://www.workflowmax.com/contact-us).

After obtaining an API Key and Account Key, set the values in the APIKey and AccountKey connection properties. Once these are set, you are ready to connect.

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

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

java -jar cdata.jdbc.xeroworkflowmax.jar

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

A connection string for Xero WorkflowMax will typically look like the following:

jdbc:xeroworkflowmax:APIKey=myApiKey;AccountKey=myAccountKey;

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:xeroworkflowmax:APIKey=myApiKey;AccountKey=myAccountKey;"); MyClientsDAO dao = dbi.open(MyClientsDAO.class); //do stuff with the DAO dao.close();

Xero WorkflowMax Data について

With the connection open to Xero WorkflowMax, simply call the previously defined method to retrieve data from the Clients entity in Xero WorkflowMax.

//disply the result of our 'find' method String name = dao.findNameByName("Cynthia"); System.out.println(name);

Xero WorkflowMax Data の書き方

It is also simple to write data to Xero WorkflowMax, using the previously defined method.

//add a new entry to the Clients entity dao.insert(newName, newName);

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

 
 
ダウンロード