FIREDAC TFDCONNECTION连接ORACLE

1)安装OCI

2)如图设置参数

3)连接代码:

procedure TfrmDB.ConnectDB;
begin
FDMoniFlatFileClientLink1.FileName := ExtractFilePath(Application.ExeName) + 'sql'+ FormatDateTime('yyyymmdd', now)+'.txt';
con.Close;
con.Params.Clear;
con.Params.Add('DriverID=' + DatabaseParams.driveId);
con.Params.Add('Server=' + DatabaseParams.ip);
con.Params.Add('Database=' + DatabaseParams.database);
con.Params.Add('User_Name=' + DatabaseParams.user);
con.Params.Add('Password=' + DatabaseParams.password);
if SameText(DatabaseParams.driveId, 'MySQL') then
con.Params.Add('CharacterSet=gb2312');
con.Params.Add('MonitorBy=FlatFile');
try
con.Connected := True;
Log.WriteLog(DatabaseParams.database + ' database connect ok');
except
on e: Exception do
Log.WriteLog('TfrmDB.ConnectDB ' + e.Message);
end;
end;