各製品の資料を入手。
詳細はこちら →Embarcadero RAD Studio provides a development environment for Delphi and C++Builder applications. With the CData ODBC Driver for JSON, you gain access to live JSON services within RAD Studio, abstracting the data into tables, views, and stored procedures that can be used to retrieve and update JSON services. This article will walk through connecting to JSON and creating a simple VCL application with the Form Designer.
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.
データソースへの認証については、ヘルプドキュメントの「はじめに」を参照してください。CData 製品は、JSON API を双方向データベーステーブルとして、JSON ファイルを読み取り専用ビュー(ローカル ファイル、一般的なクラウドサービスに保存されているファイル、FTP サーバー)としてモデル化します。HTTP Basic、Digest、NTLM、OAuth、FTP などの主要な認証スキームがサポートされています。詳細はヘルプドキュメントの「はじめに」を参照してください。
URI を設定して認証値を入力したら、DataModel を設定してデータ表現とデータ構造をより厳密に一致させます。
DataModel プロパティは、データをどのようにテーブルに表現するかを制御するプロパティで、次の基本設定を切り替えます。
リレーショナル表現の設定についての詳細は、ヘルプドキュメントの「JSON データのモデリング」を参照してください。また、以下の例で使用されているサンプルデータも確認できます。データには人や所有する車、それらの車に行われたさまざまなメンテナンスサービスのエントリが含まれています。
URI をバケット内のJSON ドキュメントに設定します。さらに、次のプロパティを設定して認証します。
URI をJSON ファイルへのパスに設定します。Box へ認証するには、OAuth 認証標準を使います。 認証方法については、Box への接続 を参照してください。
URI をJSON ファイルへのパスに設定します。Dropbox へ認証するには、OAuth 認証標準を使います。 認証方法については、Dropbox への接続 を参照してください。ユーザーアカウントまたはサービスアカウントで認証できます。ユーザーアカウントフローでは、以下の接続文字列で示すように、ユーザー資格情報の接続プロパティを設定する必要はありません。 URI=dropbox://folder1/file.json; InitiateOAuth=GETANDREFRESH; OAuthClientId=oauthclientid1; OAuthClientSecret=oauthcliensecret1; CallbackUrl=http://localhost:12345;
URI をJSON ファイルを含むドキュメントライブラリに設定します。認証するには、User、Password、およびStorageBaseURL を設定します。
URI をJSON ファイルを含むドキュメントライブラリに設定します。StorageBaseURL は任意です。指定しない場合、ドライバーはルートドライブで動作します。 認証するには、OAuth 認証標準を使用します。
URI をJSON ファイルへのパスが付いたサーバーのアドレスに設定します。認証するには、User およびPassword を設定します。
デスクトップアプリケーションからのGoogle への認証には、InitiateOAuth をGETANDREFRESH に設定して、接続してください。詳細はドキュメントの「Google Drive への接続」を参照してください。
You can then follow the steps below to use the Data Explorer to create a FireDAC connection to JSON services.
Follow the procedure below to start executing queries to JSON services from a simple VCL application that displays the results of a query in a grid.
Drop a TFDConnection component onto the form and set the following properties:
Drop a TFDQuery component onto the form and set the properties below:
SQL: Click the button in the SQL property and enter a query. For example:
SELECT [people].[personal.age] AS age, [people].[personal.gender] AS gender,
[people].[personal.name.first] AS first_name, [people].[personal.name.last] AS last_name, [vehicles].[model], FROM
[people] JOIN [vehicles] ON [people].[_id] = [vehicles].[people_id]
Drop a TDataSource component onto the form and set the following property:
Drop a TDBGrid control onto the form and set the following property:
You now have an executable application that displays the results of the SQL Query set in the TFDQuery object.
Below you can find other articles for using the CData ODBC Driver with RAD Studio, Delphi, and C++ Builder.