LoginSignup
1
2

More than 1 year has passed since last update.

FireDACでDB接続

Last updated at Posted at 2021-02-24

【Delphi】業務アプリの作り方 目次

DelphiからPostgreSQLのDBへ接続する手順を記載

前提条件

以下が完了していること

以下を理解していること

新しいフォームの作成

Delphiでプロジェクトを開き、「ファイル」>「新規作成」>「VCLフォーム - Delphi」を選択する。

「ファイル」>「名前をつけて保存」で保存する

コンポーネントを配置

パレット(Ctrl + Alt + P)から下記のコンポーネントをフォームに配置する

  • TFDPhysPgDriverLink
  • TFDConnection

image.png

プロパティの設定

オブジェクトインスペクタから以下のプロパティを設定する
※左側にオブジェクトインスペクタが見当たらなければF11を押す

プロパティ 設定値
DriverName PostgreSQLの場合固定値で'PG'
Params.Database データベース名
Params.UserName ロール名
Params.Password ロールのパスワード
Params.Server IPアドレス(別サーバにDBがある場合)

設定後、Connectedtrueにする
image.png

OKを押す
image.png
エラーにならなければ接続完了
image.png

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2