今すぐお試しください!

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

今すぐダウンロード

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

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

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

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

EDGAR Online への接続を開く

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

  1. Navigate to https://developer.edgar-online.com/ and create an account.
  2. Register a new application and retrieve the AppKey. You should select one of the available Web APIs this application will use like HackPack, Insider Trades or Institutional Ownership.
    Note: HackPack is the most important Web API that an application can use since it supports a large number of endpoints. If you are getting the "Access Denied" error you must create a new app and select the correct Web API which supports the resource you are querying.
  3. After successfully creating a new app, you can access your keys through your "my account" area. Set the AppKey connection property value equal to the Key of your application.

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

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

java -jar cdata.jdbc.edgaronline.jar

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

A connection string for EDGAR Online will typically look like the following:

jdbc:edgaronline:AppKey=20dd8ce9904d422ed89ebde1ad40d

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:edgaronline:AppKey=20dd8ce9904d422ed89ebde1ad40d"); MySubscriptionsDAO dao = dbi.open(MySubscriptionsDAO.class); //do stuff with the DAO dao.close();

EDGAR Online Data について

With the connection open to EDGAR Online, simply call the previously defined method to retrieve data from the Subscriptions entity in EDGAR Online.

//disply the result of our 'find' method String name = dao.findNameBySubscriberEmail("user@domain.com"); System.out.println(name);

EDGAR Online Data の書き方

It is also simple to write data to EDGAR Online, using the previously defined method.

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

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

 
 
ダウンロード