Delphi + ADO + PostgreSQL

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
Marcin W.
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 24.04.2007, 11:57

Delphi + ADO + PostgreSQL

Post by Marcin W. »

1. On computer an ODBC driver for Postgres is installed and configured properly

2. I choose in ZConnection Protocol: ADO and Provider: MSDASQL.1;Persist Security Info=False;Data Source=PostgreSQL

3. IP address of Postgres is set in ODBC

4. If I choose IP of my local PC and try to open Query - it's OK, but if I choose remote host and try open Query, got an error "nieokreślony błąd" (unknown/undefined error)

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  i : integer;
begin
  ZConnection1.User     := LabeledEdit1.Text;
  ZConnection1.Password := LabeledEdit2.Text;

  try
    ZConnection1.Connect;
  except
    on E : Exception do
        begin
          ShowMessage('error connecing: ' + E.Message);
        end;
  end;

  if (ZReadOnlyQuery1.Active) then
    ZReadOnlyQuery1.Active := false;

  ZReadOnlyQuery1.SQL.Clear;
  ZReadOnlyQuery1.SQL.Add('select * from ankieta_zestaw where widoczne = :p_widoczne;');

  ZReadOnlyQuery1.Params.Clear;
  ZReadOnlyQuery1.Params.CreateParam(ftInteger, 'p_widoczne', ptInput);
  ZReadOnlyQuery1.ParamByName('p_widoczne').AsInteger := 1;

  try
    ZReadOnlyQuery1.Open;
  except
    on E : Exception do
        begin
          ShowMessage('error opening: ' + E.Message);
        end;
  end;

end;
mrLion
Senior Boarder
Senior Boarder
Posts: 71
Joined: 20.03.2010, 10:17

Post by mrLion »

Marcin W., why use ADO? use direct access "postgresql" - protocol. ADO - is bad idea.
Marcin W.
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 24.04.2007, 11:57

Post by Marcin W. »

I know, that it is a bad idea, but I have to.
mrLion
Senior Boarder
Senior Boarder
Posts: 71
Joined: 20.03.2010, 10:17

Post by mrLion »

Marcin W., can`t understand ..... why? Simple change one property to postgresql and that`s all....
Post Reply