unit Unit2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FireDAC.Stan.Def,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FireDAC.Phys.MySQLDef, FireDAC.Stan.Intf, FireDAC.Phys,
FireDAC.Phys.MySQL, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Comp.Client,
FMX.Controls.Presentation, FMX.StdCtrls, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.FMXUI.Wait, Data.DB;
type
TForm2 =
class(TForm)
FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink;
Button1: TButton;
FDManager1: TFDManager;
FDConnection1: TFDConnection;
procedure Button1Click(Sender: TObject);
procedure FDManager1AfterLoadConnectionDefFile(Sender: TObject);
procedure FDPhysMySQLDriverLink1DriverCreated(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
const
cNameConnDef = '
MYSQL_Connection';
implementation
{$R *.fmx}
procedure TForm2.Button1Click(Sender: TObject);
begin
var
oDef: IFDStanConnectionDef;
oParams: TFDPhysMySQLConnectionDefParams;
// MSSQL connection params (Anm: umbenannt in MySQL)
begin
// Adding new persistent connection to fdconnectiondefs.ini
FDManager.ConnectionDefs.AddConnectionDef;
oDef := FDManager.ConnectionDefs.AddConnectionDef;
oDef.
Name := cNameConnDef;
oParams := TFDPhysMSSQLConnectionDefParams(oDef.Params);
oParams.DriverID := '
MYSQL'
oParams.Database := '
Test';
oParams.UserName := '
root';
oParams.Password := '
XXXX';
oParams.Server := '
192.168.175.38';
oParams.OSAuthent := false;
oParams.MARS := false;
oDef.MarkPersistent;
oDef.Apply;
end;
end.