program hello;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Data.DB,
FireDAC.Stan.Def,
FireDAC.Phys.DB2,
FireDac.Comp.Client,
FireDAC.Stan.Consts,
System.IOUtils;
var
Connection : TFDConnection;
Link : TFDPhysDB2DriverLink;
begin
{$ifdef LINUX}
Link := TFDPhysDB2DriverLink.Create(
nil);
Link.VendorHome := TPath.Combine(TPath.GetHomePath, '
sqllib/lib64');
Link.VendorLib := '
libdb2.so';
writeln(Link.VendorHome);
{$endif}
Connection := TFDConnection.Create(
nil);
try
Connection.Params.DriverID := '
DB2';
Connection.Params.Values['
Server'] := '
<xx.xxx.xx.xx>';
Connection.Params.Values['
Port'] := '
50000';
Connection.Params.Values['
Protocol'] := '
TCPIP';
Connection.Params.Values['
Database'] := '
<dbname>';
Connection.Params.Values['
User_Name'] := '
<user>';
Connection.Params.Values['
Password'] := '
<password>';
Connection.Connected := True;
writeln('
Connected');
Readln;
except
on E:
Exception do
writeln(E.ClassName, '
: ', E.
Message);
end;
Connection.Free;
end.