Viewing Access データ in RAD Studio Data Explorer

How to view Access データ in RAD Studio Data Explorer using the CData ODBC Driver for Access.

最終更新日:2023-06-12

Embarcadero RAD Studio provides a development environment for Delphi and C++Builder applications. With the CData ODBC Driver for Access, you gain access to live Access データ within RAD Studio, abstracting the data into tables, views, and stored procedures that can be used to both retrieve and update Access データ. This article will walk through connecting to Access using the Data Explorer.

Configure a Connection to Access

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.

Access接続の設定方法

ローカルファイルへの接続設定

ローカル環境からAccess への接続は非常にシンプルです。ConnectionTypeLocal に設定することで、CRUD 操作(SELECT、INSERT、UPDATE、DELETE)をすべて実行できます。接続にはDataSource プロパティに以下のようなAcces sデータベースファイルのフルパスを指定します。

C:\Users\Public\Documents\MyDatabase.accdb

詳細な接続手順については、ヘルプドキュメントの「はじめに」セクションをご参照ください。

クラウドストレージ上のAccess ファイルへの接続設定

各種クラウドストレージに保存されているAccess ファイルへのアクセスにも対応しています。ただし、クラウド上のファイルに対するデータ操作は、INSERT、UPDATE、DELETE に制限されますのでご注意ください。

S3、Google Driver、OneDrive など、各種クラウドストレージ内のAccess ファイルへの接続方法はこちらの記事をご確認ください。

クラウド上のファイルを更新したい場合は、以下の手順で実施いただけます。

  1. 対応するCData ドライバーを利用し、クラウドサービスからAccess ファイルをダウンロード
  2. Access ドライバーを使用して、ローカル環境でファイルを編集
  3. クラウドサービス用ドライバーのストアドプロシージャを使用して、更新ファイルをアップロード

具体例として、SharePoint 上のファイルを更新する場合の手順をご紹介します。

  1. CData SharePoint ドライバーのDownloadDocument プロシージャを使用してファイルを取得
  2. CData Access ドライバーでファイルの更新を実施
  3. SharePoint ドライバーのUploadDocument プロシージャで更新内容を反映

DataSource 接続プロパティの設定について補足いたします。接続先のクラウドストレージを識別するための一意の接頭辞を指定し、続けて目的のファイルパスまたはフォルダパスを記述します。フォルダを指定した場合は1ファイルが1テーブルとして、単一ファイルの場合は単一テーブルとして扱われます。

Connecting to Access データ Using Data Explorer

You can create a simple application for displaying Access データ by utilizing the CData FireDAC Components for Access and a new VCL Forms Application:

  1. Open the Data Explorer in RAD Studio and expand FireDAC.
  2. Right-click the ODBC Data Source node in the Data Explorer.
  3. Click Add New Connection.
  4. Enter a name for the connection.
  5. In the FireDAC Connection Editor that appears, set the DataSource property to the name of the ODBC DSN for Access.
  6. Back in the Data Explorer, expand the tables for the connection.
  7. Create a new VCL Forms application and drag a table (for example: Orders) onto the form.

  8. Select the OrdersTable object on the form and set the Active property to true.
  9. Right-click on the object, bind visually, and link everything (*) to a new control (TStringGrid).

  10. Arrange the TStringGrid on the form and run the application to see the Orders data.

Related Articles

Below you can find other articles for using the CData ODBC Driver with RAD Studio, Delphi, and C++ Builder.

関連コンテンツ

トライアル・お問い合わせ

30日間無償トライアルで、CData のリアルタイムデータ連携をフルにお試しいただけます。記事や製品についてのご質問があればお気軽にお問い合わせください。