Delphi + ADO + PostgreSQL
Posted: 06.10.2010, 12:51
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)
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;