Ready to get started?

Learn more about the CData JDBC Driver for PayPal or download a free trial:

Download Now

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

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

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

PayPal Transactions 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 MyTransactionsDAO { //request specific data from PayPal (String type is used for simplicity) @SqlQuery("SELECT GrossAmount FROM Transactions WHERE TransactionClass = :transactionClass") String findGrossAmountByTransactionClass(@Bind("transactionClass") String transactionClass); /* * close with no args is used to close the connection */ void close(); }

PayPal への接続を開く

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

The provider surfaces tables from two PayPal APIs. The APIs use different authentication methods.

  • The REST API uses the OAuth standard. To authenticate to the REST API, you will need to set the OAuthClientId, OAuthClientSecret, and CallbackURL properties.
  • The Classic API requires Signature API credentials. To authenticate to the Classic API, you will need to obtain an API username, password, and signature.

See the "Getting Started" chapter of the help documentation for a guide to obtaining the necessary API credentials.

To select the API you want to work with, you can set the Schema property to REST or SOAP. By default the SOAP schema will be used.

For testing purposes you can set UseSandbox to true and use sandbox credentials.


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

java -jar cdata.jdbc.paypal.jar

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

A connection string for PayPal will typically look like the following:


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:paypal:Schema=SOAP;;Password=xyz123;Signature=zx2127;InitiateOAuth=GETANDREFRESH"); MyTransactionsDAO dao =; //do stuff with the DAO dao.close();

PayPal Data について

With the connection open to PayPal, simply call the previously defined method to retrieve data from the Transactions entity in PayPal.

//disply the result of our 'find' method String grossAmount = dao.findGrossAmountByTransactionClass("Received"); System.out.println(grossAmount);

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