各製品の資料を入手。
詳細はこちら →Viewing HubDB データ in RAD Studio Data Explorer
How to view HubDB データ in RAD Studio Data Explorer using the CData ODBC Driver for HubDB.
最終更新日:2023-06-12Embarcadero RAD Studio provides a development environment for Delphi and C++Builder applications. With the CData ODBC Driver for HubDB, you gain access to live HubDB データ within RAD Studio, abstracting the data into tables, views, and stored procedures that can be used to both retrieve and update HubDB データ. This article will walk through connecting to HubDB using the Data Explorer.
Configure a Connection to HubDB
If you have not already, first specify connection properties in an ODBC DSN (data source name). This is the last step of the driver installation. You can use the Microsoft ODBC Data Source Administrator to create and configure ODBC DSNs.
HubDBデータソースへの接続には、パブリックHubSpotアプリケーションを使用したOAuth認証とプライベートアプリケーショントークンを使用した認証の2つの方法があります。
カスタムOAuthアプリを使用する
すべてのOAuthフローでAuthSchemeを"OAuth"に設定する必要があります。特定の認証ニーズ(デスクトップアプリケーション、Webアプリケーション、ヘッドレスマシン)に必要な接続プロパティについては、ヘルプドキュメントを確認してください。
アプリケーションを登録し、OAuthクライアント認証情報を取得するには、以下の手順を実行してください。
- HubSpotアプリ開発者アカウントにログインします。
- アプリ開発者アカウントである必要があります。標準のHubSpotアカウントではパブリックアプリを作成できません。
- 開発者アカウントのホームページで、アプリタブをクリックします。
- アプリを作成をクリックします。
- アプリ情報タブで、ユーザーが接続する際に表示される値を入力し、必要に応じて変更します。これらの値には、パブリックアプリケーション名、アプリケーションロゴ、アプリケーションの説明が含まれます。
- 認証タブで、「リダイレクトURL」ボックスにコールバックURLを入力します。
- デスクトップアプリケーションを作成する場合は、http://localhost:33333のようなローカルにアクセス可能なURLに設定します。
- Webアプリケーションを作成する場合は、ユーザーがアプリケーションを承認した際にリダイレクトされる信頼できるURLに設定します。
- アプリを作成をクリックします。HubSpotがアプリケーションとそれに関連する認証情報を生成します。
- 認証タブで、クライアントIDとクライアントシークレットを確認します。これらは後でドライバーを設定する際に使用します。
スコープの下で、アプリケーションの意図する機能に必要なスコープを選択します。
テーブルにアクセスするには、最低限以下のスコープが必要です:
- hubdb
- oauth
- crm.objects.owners.read
- 変更を保存をクリックします。
- 統合に必要な機能にアクセスできる本番ポータルにアプリケーションをインストールします。
- 「インストールURL(OAuth)」の下で、完全なURLをコピーをクリックして、アプリケーションのインストールURLをコピーします。
- コピーしたリンクをブラウザで開きます。アプリケーションをインストールする標準アカウントを選択します。
- アプリを接続をクリックします。結果のタブは閉じて構いません。
プライベートアプリを使用する
HubSpotプライベートアプリケーショントークンを使用して接続するには、AuthSchemeプロパティを"PrivateApp"に設定します。
以下の手順に従ってプライベートアプリケーショントークンを生成できます:
- HubDBアカウントで、メインナビゲーションバーの設定アイコン(歯車)をクリックします。
- 左サイドバーメニューで、統合 > プライベートアプリに移動します。
- プライベートアプリを作成をクリックします。
- 基本情報タブで、アプリケーションの詳細(名前、ロゴ、説明)を設定します。
- スコープタブで、プライベートアプリケーションがアクセスできるようにしたい各スコープに対して読み取りまたは書き込みを選択します。
- テーブルにアクセスするには、最低限hubdbとcrm.objects.owners.readが必要です。
- アプリケーションの設定が完了したら、右上のアプリを作成をクリックします。
- アプリケーションのアクセストークンに関する情報を確認し、作成を続行をクリックし、その後トークンを表示をクリックします。
- コピーをクリックして、プライベートアプリケーショントークンをコピーします。
接続するには、PrivateAppTokenを取得したプライベートアプリケーショントークンに設定します。
Connecting to HubDB データ Using Data Explorer
You can create a simple application for displaying HubDB データ by utilizing the CData FireDAC Components for HubDB and a new VCL Forms Application:
- Open the Data Explorer in RAD Studio and expand FireDAC.
- Right-click the ODBC Data Source node in the Data Explorer.
- Click Add New Connection.
- Enter a name for the connection.
- In the FireDAC Connection Editor that appears, set the DataSource property to the name of the ODBC DSN for HubDB.
- Back in the Data Explorer, expand the tables for the connection.
Create a new VCL Forms application and drag a table (for example: NorthwindProducts) onto the form.
- Select the NorthwindProductsTable object on the form and set the Active property to true.
Right-click on the object, bind visually, and link everything (*) to a new control (TStringGrid).
Arrange the TStringGrid on the form and run the application to see the NorthwindProducts data.
Related Articles
Below you can find other articles for using the CData ODBC Driver with RAD Studio, Delphi, and C++ Builder.