製品をチェック

無償トライアル:

無償トライアルへ

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

ShipStation JDBC Driver

ShipStation データに連携するJava アプリケーションを素早く、簡単に開発できる便利なドライバー。

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

お問い合わせ

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


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


shipstation ロゴ画像
jdbc ロゴ画像

JDBC

JDBI ロゴ画像

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

ShipStation Tags Entity のDAO を作成

以下のインターフェースは、実装されるSQL ステートメントごとに単一のメソッドを作成するためのSQL オブジェクトの正しい動作を宣言します。

public interface MyTagsDAO { //request specific data from ShipStation (String type is used for simplicity) @SqlQuery("SELECT Color FROM Tags WHERE CustomerId = :customerId") String findColorByCustomerId(@Bind("customerId") String customerId); /* * close with no args is used to close the connection */ void close(); }

ShipStation への接続を開く

必要な接続プロパティを収集し、ShipStation に接続するための適切なJDBC URL を作成します。

Use the BASIC Authentication standard to connect.

  1. Login to your ShipStation account
  2. Click on the settings icon in the upper right corner. A column menu will show up on the left
  3. Click Account -> API Settings
  4. On the API Settings page, note the API Key and API Secret.

Authenticating to ShipStation

  • APIKey: Set this to the API key from the API settings page.
  • APISecret: Set this to the Secret key from the API settings page.

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

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

java -jar cdata.jdbc.shipstation.jar

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

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

ShipStation の接続文字列は、通常次のようになります。

jdbc:shipstation:APIKey='YourAPIKey';APISecret='YourAPISecret'

構成済みのJDBC URL を使用して、DAO インターフェースのインスタンスを取得します。以下に示す特定のメソッドはインスタンスにバインドされたハンドルを開くため、ハンドルとバインドされたJDBC 接続を開放するには、インスタンスを明示的に閉じる必要があります。

DBI dbi = new DBI("jdbc:shipstation:APIKey='YourAPIKey';APISecret='YourAPISecret'"); MyTagsDAO dao = dbi.open(MyTagsDAO.class); //do stuff with the DAO dao.close();

ShipStation Data について

ShipStation への接続を開いた状態で以前定義したメソッドを呼び出すだけで、ShipStation のTags エンティティからデータを取得できます。

//disply the result of our 'find' method String color = dao.findColorByCustomerId("1368175"); System.out.println(color);

JDBI ライブラリはJDBC 接続を処理できるため、CData JDBC Driver for ShipStation と統合することで、SQL Object API for ShipStation を簡単に作成できます。今すぐ無料トライアルをダウンロードし、Java アプリケーションでライブShipStation を操作しましょう。