Advantage Database Server/ja

From Lazarus wiki
Jump to navigationJump to search

English (en) français (fr) 日本語 (ja)

データベースのポータル

参照:

チュートリアル/練習となる記事:

各種データベース

Advantage - MySQL - MSSQL - Postgres - Interbase - Firebird - Oracle - ODBC - Paradox - SQLite - dBASE - MS Access - Zeos

概要

この短いチュートリアルはAdvantage Database ServerによってホストされるテーブルにAdvantage TDataSet/ja派生を使用し始めることを意図している。

Advantage TDataSetのインストール

Windows

もしWindowsにAdvantage TDataSetインストールするには、Advantage Delphiコンポーネントをダウンロードしてインストールする必要がある(version 10.1 もしくはそれ以降)。 インストールメディアはAdvantageウェブサイトよりダウンロードできるhere.

Linux

Advantage TDataSetをLinuxにインストールするには、2つの段階を踏まえる必要がある。最初にLinux用のAdvantage Client Engine(バージョン10.1)をダウンロードしてインストール 、次いでLinux TDataSetソースtarボールをダウンロードしてインストールする。両方ともhttp://devzone.advantagedatabase.comのAdvantage Developer Zpneにある(The Advantage Client EngineダウンロードはAdvantage Developer Zoneの"Product Download"セクションにあり、Linux TDataSetソースはCodeCentralのDelphi Applicationsセクションにある)。

Installing the Advantage Package

Once the TDataSet Descendant is installed, you'll want to move on to installing the package into Lazarus.

  1. From Lazarus, click on "Package", then "Open Package File (.lpk)..." and browse to the adsl.lpk file in the TDataSet installation directory (or in the directory you extracted the TDataSet source).
  2. In the package window, click the "Compile" button.
  3. Upon successful compilation, click the "Install" button, and select "Yes" to rebuild Lazarus.
  4. The Lazarus IDE should successfully compile and re-start with the Advantage components installed.

A simple Advantage project

Start a new project to start working with Advantage data.

  1. Drop a TAdsConnection object from the Advantage tab of the palette onto your form. (The TAdsConnection object is the left-most object on the Advantage tab.)
  2. In the Object Inspector, click the drop-down for the AliasName property, and select "ADTDemoData".
    • Alternately, you can select the ConnectPath property and enter (or browse to) the path to the Help\ADS_Data directory beneath your TDataSet (or acesdk on Linux) install directory.
  3. Expand the AdsServerTypes property, and change the "stADS_LOCAL" property to True.
    • If you have an Advantage Database server configured and running, you may set "stADS_REMOTE" to true instead.
  4. Drop a TAdsTable object on the form. (The TAdsTable object is immediately to the right of the TAdsConnection object on the tab, and it looks like a red table.)
  5. Set the AdsConnection Property for AdsTable1 to AdsConnection1 (the connection object you just dropped in step 1.)
  6. Scroll down to the "TableName" property, and use the drop-down box to select the biolife.adt table.
  7. Drop a TDataSource component on the form, and set its DataSet property to "AdsTable1".
  8. Drop a TDBGrid component on the form, and set its "DataSource" property to "Datasource1".
  9. At this point, you should be able to select the AdsTable1 object and set its "Active" property to "True".
  10. Finally, run the project. (Note that you may need to save the project before running it.)

Since the Advantage components descend from the TDataSet, you can use these components with any data-aware component that supports the TDataSet. This extremely simple example should demonstrate how simple it is to get started with Advantage.