Domanda

I am trying to connect my Delphi application to Informix database using fireDAC. I all the parameters supplied in connection editor. But I have to run PA Server to make it work.

So is it necessary to run the PA Server to connect to Informix db.

È stato utile?

Soluzione

I am able to solve it using the following code to connect instead of dragging droping he controls:

procedure TForm1.FormCreate(Sender: TObject);
var
Params: TStringList;
begin
 FDManager := TFDManager.Create(self);
 FDconnection := TFDConnection.Create(self);
 FDQuery := TFDQuery.Create(self);
 FDataSOurce := TDataSource.Create(self);
 Params := TStringList.create;
 Params.Values['User_Name'] := paramstr(3);
 Params.Values['Database'] := paramstr(2);
 Params.Values['Password'] := paramstr(4);
 Params.Values['DriverName'] := 'Informix';
 Params.Values['HostName'] := paramstr(1);
 Params.Values['RDBMS'] := 'OTHER';
 Params.Values['DriverID'] := 'TDBX';
 FDManager.AddConnectionDef('BOSSConnection', 'TDBX', Params);
 FDConnection.DriverName := 'TDBX';
 FDConnection.ConnectionDefName:='BOSSConnection';
 FDConnection.Connected := True;
 FDQuery.SQL.Add('select first 10 cust_code, bus_name, status from strcustr;');
 FDQuery.Connection := FDConnection;
 FDataSource.DataSet := FDQuery;
 FDQuery.Active := True;
 DBGrid1.DataSource := FDataSource;
 FDConnection.LoginPrompt := False;
end;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top