Delphi 2010 + Zeos + PostgreSQL

Forum related to PostgreSQL

Moderators: gto, cipto_kh, EgonHugeist, olehs

rblsystem
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 26.12.2013, 16:50

Delphi 2010 + Zeos + PostgreSQL

Postby rblsystem » 16.01.2014, 11:42

Hello guys , okay ?
 
    I'm trying to display a DBGrid result is a select in PostgreSQL DB . For this, I am using Zeos .
 
    The connection to the database is being made through ZConnection component. I set all component properties and make the connection and usually works without any error .
 
    Furthermore , I can also connect to the database using pgAdmin . I can access the tables , and also to select etc with no problem .
 
    The problem happens with ZQuery component. Using this component , return the select is :
 
Error 1 :
 
With ZQuery1 Do Begin
Close ;
Sql.Clear ;
Sql.Add ( 'SELECT * ' ) ;
Sql.Add ( 'FROM clients ' ) ;
Open ;
end ;
 
SQL Error : ERROR : prepared statement " 13607504130690304 " does not exist .
 
    Or, the following error appears :
 
Error 2 :
 
With ZQuery1 Do Begin
Close ;
Sql.Clear ;
Sql.Add ( 'SELECT * ' ) ;
Sql.Add ( 'FROM clients ' ) ;
ExecSql ;
end ;
 
Can not open the Resultset .
 
    Note that the only difference is that in the select uitlizo 1st OPEN and 2nd EXECSQL use .
 
    What can I be doing wrong for these errors happen ?

    I need to make some more configuration setting in ZConnection , associate another component to ZQuery ?
 
Thank you ,
 
Rogério .

marsupilami
Gold Boarder
Gold Boarder
Posts: 552
Joined: 17.01.2011, 14:17

Re: Delphi 2010 + Zeos + PostgreSQL

Postby marsupilami » 16.01.2014, 12:27

Hello Rogério,

which Version of Zeos and PostgreSQL do you use?
Best regards,

Jan

rblsystem
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 26.12.2013, 16:50

Re: Delphi 2010 + Zeos + PostgreSQL

Postby rblsystem » 16.01.2014, 14:02

Jan,

Zeos version 7.0.0 alpha
PostgreSQL version 9.1.1

Thanks a lot.

rblsystem
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 26.12.2013, 16:50

Re: Delphi 2010 + Zeos + PostgreSQL

Postby rblsystem » 16.01.2014, 14:13

Sorry,

The correct version of Zeos is 7.1.2 stable

PostgreSQL version is 9.1.1

Thanks a lot,

Rogério.

marsupilami
Gold Boarder
Gold Boarder
Posts: 552
Joined: 17.01.2011, 14:17

Re: Delphi 2010 + Zeos + PostgreSQL

Postby marsupilami » 16.01.2014, 19:51

Hello Rogério,

this is strange because I use the current Zeos 7.1 with Postgresql too. But for me it is 7.1-patches from the SVN. PostgreSQl is Version 9.2 here and Delphi is Delphi 2007 and Delphi XE 2.
Which settings do you do in the ZConnection Object?

ZQuery.Execute is only for executing statements that have no result sets, like update statements. If you want to do a select always use open.

Best regards,

Jan

rblsystem
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 26.12.2013, 16:50

Re: Delphi 2010 + Zeos + PostgreSQL

Postby rblsystem » 17.01.2014, 11:54

The settings are:

ControlsCodePAge = cCP_UTF16
LibraryLocation = ...\libpq73.dll
Port = 5432
Protocol = postgresql-9

If you still miss some information on the settings, let me know so I can inform correctly. Or, if you miss a particular property, ask me what I inform.

As for the version of Zeos, you think I'd better change the same that you are using?

If yes, where I Can download it?

Thank you,

Rogério.

miab3
Zeos Test Team
Zeos Test Team
Posts: 899
Joined: 11.05.2012, 12:32
Location: Poland

Re: Delphi 2010 + Zeos + PostgreSQL

Postby miab3 » 17.01.2014, 12:02

@rblsystem,

LibraryLocation = ...\libpq73.dll

This is not a good library. (It is 10 years old).
Use of this included in the server 9.1.1 distribution.

Why do you not write about all this in the first post?

Michal

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: Delphi 2010 + Zeos + PostgreSQL

Postby EgonHugeist » 22.01.2014, 06:18

What i'm doing, i can't reproduce your reported issue.

Does Michal's advice help you? Is your iussue resolved?
King regards, Michael

You want to help? viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image

ricardoclaudine
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 04.06.2014, 14:24
Location: Maringá, Paraná, Brasil

Re: Delphi 2010 + Zeos + PostgreSQL

Postby ricardoclaudine » 04.06.2014, 14:26

Friend, this problem occurs when using a recent Zeus version that works with Real Prepared Statement (and not with Emulated Prepared Statement as before) connecting to a PostgreSQL Server with active pgBouncer and configured in "Transaction Pooling" Mode. This Mode does not support Prepared Statements, but not figured out how to disable them in Zeus:
 
https://wiki.postgresql.org/wiki/PgBouncer
http://pgbouncer.projects.pgfoundry.org ... on_pooling
 
If anyone knows how to disable Prepared Statements in Zeus, help me please!
 
 
Thanks!

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: Delphi 2010 + Zeos + PostgreSQL

Postby EgonHugeist » 27.06.2014, 22:21

Lorbs...

Code: Select all

function TZPostgreSQLConnection.CreatePreparedStatement(
  const SQL: string; Info: TStrings): IZPreparedStatement;
begin
  if IsClosed then
     Open;

  {$IFDEF ZEOS_TEST_ONLY}
  Case GetTestMode of
    0:
  {$ENDIF}
      if GetServerMajorVersion >= 8 then
        Result := TZPostgreSQLCAPIPreparedStatement.Create(GetPlainDriver, Self, SQL, Info)
      else
        Result := TZPostgreSQLClassicPreparedStatement.Create(GetPlainDriver, Self, SQL, Info);
  {$IFDEF ZEOS_TEST_ONLY}
    1: Result := TZPostgreSQLClassicPreparedStatement.Create(GetPlainDriver, Self, SQL, Info);
  end;
  {$ENDIF}
end;


You could patch back to the TZPostgreSQLClassicPreparedStatement but this is'nt the solution at all. Have to think about a simple TZConnection.Properties[''] parameter..
I think i can fix this quickly...

Michael
King regards, Michael

You want to help? viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: Delphi 2010 + Zeos + PostgreSQL

Postby EgonHugeist » 27.06.2014, 22:36

Edit:

Patch done R3178 /testing-7.2 (SVN)

Add TZConneciton.Properties.Values['EMULATE_PREPARES'] := 'True'; and all is fine again
King regards, Michael

You want to help? viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: Delphi 2010 + Zeos + PostgreSQL

Postby EgonHugeist » 04.07.2014, 23:18

Triple post:

my first patch was wrong! Second fix is already commited. Our Prepared stmts are able to fall back to 100% emulation modes. Add the suggested param and it should work fine.
King regards, Michael

You want to help? viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image


Return to “PostgreSQL”

Who is online

Users browsing this forum: No registered users and 0 guests