Page 1 of 1
How to Install ZEOS.
Posted: 16.04.2016, 10:39
by miab3
How to Install ZEOS.
Locate the appropriate version of the packages, and:
zcore - open/load - compile/build,
zplain - open/load - compile/build,
zparsesql - open/load - compile/build,
zdbc - open/load - compile/build,
zcomponent - open/load - compile/build; (rebuild Lazarus- only ZEOS<8 Lazarus).
(If necessary, for Delphi XE2 and higher, repeat after switching the compiler)
zcomponentdesign(only Delphi - Win32) - open/load - install; (rebuild Lazarus- only ZEOS8 Lazarus)
(For Delphi, you can use the groupproj file.)
For Delphi, find and add dcu directory to your Delphi 'Library path:' e.g. $(BDS)\Libs\Zeos\packages\DelphiXE2\Win32\Debug for Win32
or/and $(BDS)\Libs\Zeos\packages\DelphiXE2\Win64\Debug for Win64.(If $(BDS)\Libs is an example directory where you put the Zeos directory).
For Delphi for debugging, you can add paths to sources in 'Browsing path:'.
Often found: Placing paths to sources in 'Library path:' is a mistake (especially for Delphi XE2 and higher - many compilers) !!!
(Because it forces to recompile ZEOS units that have already been compiled once)
Michal
Re: How to Install ZEOS.
Posted: 01.04.2020, 14:21
by timg11
Running Delphi 7 in Windows 10. I'm trying to connect to PostgreSQL.
I installed ZEOS according to the instructions in this thread. The components are installed and visible in the components palette.
When trying to build the Zeos Examples projects, I get the following results:
ZBlobs - cannot build - Error "Field frmMain.cbxOidAsBlob does not have a corresponding component. Remove the declaration?"
ZControlsExample - cannot build - error: "Field frmMain.ZQueryZ does not have a corresponding component. Remove the declaration?"
DbcDemo - cannot build - error: "[Error] DbcDemoMain.pas(75): Undeclared identifier: 'TStringDynArray'"
ZDesignTime - cannot open project - Error: "Error reading Form: Error reading qrMain.RequestLive: Property RequestLive does not exist. Ignore the error and continue? NOTE: Ignoring the error may cause components to be deleted or property values to be lost."
Embedded - compiles, but exception on run: " Project Embedded.exe raised exception class Exception with message None of the dynamic libraries can be found or is not loadable: Iibmysqld4l .dll, Iibmysqld.dlI Use TZConnection.LibraryLocation if the location is invalid.. Process stopped. Use Step or Run to continue."
ZSimple - cannot build - error: "Field frmMain.ZQueryZ does not have a corresponding component. Remove the declaration?"
Re: How to Install ZEOS.
Posted: 02.04.2020, 17:41
by miab3
Hi @timg11,
Which specific Zeos versions and/or svn revision have you installed?
As a side note, the examples in "examples" are somewhat outdated.
A good check of the correct installation is to build the simplest application with:
ZConnection1: TZConnection;
ZTable1: TZTable; (or ZQuery1: TZQuery)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
The right connection between them;
Setting parameters(Properties) to an existing, known and valid database and table:
(In a kind Protocol, HostName, Database, User, Password, ClientCodepage; TableName or SQL);
Uses in event ZTable1.Active := True; (or ZQuery1.Active := True;);
Compiling, and try to start.
(Of course, the client libraries of a particular database must be seen by the application in the operating system).
Michal
Re: How to Install ZEOS.
Posted: 03.04.2020, 11:40
by marsupilami
Hello,
timg11 wrote: ↑01.04.2020, 14:21
Running Delphi 7 in Windows 10.
A side note: I don't know your circumstances. We had several problems with Delphi 7 in the past. Maybe it is good to check if you can do your project with the current Community Edition of Delphi or with Lazarus.
timg11 wrote: ↑01.04.2020, 14:21
I'm trying to connect to PostgreSQL.
I installed ZEOS according to the instructions in this thread. The components are installed and visible in the components palette.
Sounds good so far.
timg11 wrote: ↑01.04.2020, 14:21
When trying to build the Zeos Examples projects, I get the following results:
ZBlobs - cannot build - Error "Field frmMain.cbxOidAsBlob does not have a corresponding component. Remove the declaration?"
ZControlsExample - cannot build - error: "Field frmMain.ZQueryZ does not have a corresponding component. Remove the declaration?"
DbcDemo - cannot build - error: "[Error] DbcDemoMain.pas(75): Undeclared identifier: 'TStringDynArray'"
ZDesignTime - cannot open project - Error: "Error reading Form: Error reading qrMain.RequestLive: Property RequestLive does not exist. Ignore the error and continue? NOTE: Ignoring the error may cause components to be deleted or property values to be lost."
Embedded - compiles, but exception on run: " Project Embedded.exe raised exception class Exception with message None of the dynamic libraries can be found or is not loadable: Iibmysqld4l .dll, Iibmysqld.dlI Use TZConnection.LibraryLocation if the location is invalid.. Process stopped. Use Step or Run to continue."
ZSimple - cannot build - error: "Field frmMain.ZQueryZ does not have a corresponding component. Remove the declaration?"
I have a problem when compiling with Delphi 7 currently, so I tried the projects using Delphi 2007.
ZBlobs, ZControlsExample, ZDesignTime and ZSimple:
The question "xxx does not have a corresponding component. Remove the declaration?" sounds like somehow the dfm files got damaged or controls got removed while opening the form file. Could you try to unpack or download the examples again, to make sure, they are not damaged?
ZBlobs:
Please note that the protocol list in that project is outdated. We don't append version numbers any more. ZConnection.GetProtocols can help you to fill the Items property of the combo box.
ZDesignTime only:
This project was made on an ancient version of Zeos (Zeos 5.x). When opening it, Delph ishould ask you if it is ok to remove the properties RequestLive and ShowRecordTypes. It is ok to remove them. All other messages indicate some problem.
ZSimple only:
here it id ok if Delphi asks wether it is ok to remove the properties ExplicitWidth, ExplicitTop and ExplicitLeft. All other messages should indicate some kind of an error condition.
In this project again the protocol list is outdated.
DbcDemo:
The types unit must be added to the uses list. Afterwards it will work. Please note: This demo is about working on the DBC layer. Usually this mostly makes sense if you have no GUI. If there is a GUI, it is recommended to work with the usual components provided by Zeos.
Embedded:
This project tries to demonstrate how to work with the discontinued MySQL embedded server. There is a readme in the directory. I didn't read it but I assume that it tells you what to do to get this demo working.
Some general notes:
- Zeos usually needs the client library of the server that you want to talk with. In your case that would be libpq.dll. Please use the LibraryLocation property of TZConnection to tell Zeos where to find the client library.
- The Zeos Documentation collection might help you in getting started with Zeos. There is a tutorial in there that explains what all the components do and how to use them. The tutorial is a bit outdated. So it may contain some information that is not 100% correct anymore. I didn't get around to write a new one yet.
- I updated the examples in the Zeos 7.3 branch so they should work better now. Please downlod them from there if possible.
If you have problems, please feel free to ask
Best regards,
Jan
Re: How to Install ZEOS.
Posted: 04.04.2020, 16:26
by timg11
Jan,
Thanks for the reply. The "subscription" on this forum doesn't seem to work - I did not receive any email notification of your response. I'm using zeosdbo-7.2.6.1-stable.zip. While waiting for moderator approval here,
I asked a question on StackOverflow.
I had some suggestions proposed. I completely uninstalled and deleted and started fresh, but created a new output directory for the Zeos packages.
That seemed to work. I still had the failures compiling Simple (as you explained already), but I eventually tried other Examples, and discovered that ZControlsExample will build.
I can set it to Postgresql-9 (I'm running v12 - hopefully it doesn't matter).
It first gave an error about missing DLL libpq.dll. I copied it from C:\Program Files\PostgreSQL\12\bin to to the project directory for ZControlsExample.
Then I got an error that it couldn't load it. Searching I found that the V12 client installation was 64 bit, but of course Delphi 7 is 32 bit.
I downloaded the non-installer binaries for the last version of Postgresql with 32 bit support - 10.12 - in file "postgresql-10.12-2-windows-binaries.zip", and extracted libpql.dll to the project directory forZControlsExample.
It still fails with the exception " Project ZControlsExample raised and exception class Exception with message 'Client Library libpq.dll found but could not be loaded. Check compile target and library compatibility".
What else is needed to load the DLL?
Thanks!
Re: How to Install ZEOS.
Posted: 04.04.2020, 17:11
by timg11
I found
this thread regarding the DLL loading issue. It is for FreePascal, so maybe not relevant...
It suggested from providing these DLLs from version 12.1 (presumably 64 bit). libcrypto-1_1-x64.dll, libiconv-2.dll, libintl-8.dll, libpq.dll, libssl-1_1-x64.dll.
I copied them into the project, but got the same error. I have not used Freepascal recently, maybe it is now 64 bit?
So I copied all five of those DLLs from the version 10.12.2 32 bit binary ZIP file to the ZControlsExample project folder.
Now ZControlsExample will run and Connect without an Exception!
It still doesn't work as expected, though. Now the error is "SQL Errror: FATAL: database 'testdata' does not exist".
In fact, the database testdata does indeed exist. I have psql.exe running in a command window, and from the postgres=# prompt, I can type SELECT * FROM testdata; and get a listing of the database.
My settings in ZControlsExample are Protocol = postgresql-9, Database = testdata, host localhost, port [default], username and password for postgres user - same as for psql.exe running in a command window.
Re: How to Install ZEOS.
Posted: 04.04.2020, 18:59
by timg11
I've solved the database name problem. After looking at the pgAdmin browser, I realized that the database is postgres, and testdata is a table. Changing the database to postgres and connecting now results in an SQL Error Exception "relation "cargo" does not exist - LINE 1:select * from cargo".
I'm assuming the TZQuery objects ZCargo, ZDepartment, and ZPeople are expecting something from the database that doesn't exist in my case, so it is specific to the example project.
I'll have to see what else I can learn about the examples. But I think the libraries are working in any case.
For my Delphi application, all I need to do is put data into the database. Other tools will query it from outside of Delphi.
Re: How to Install ZEOS.
Posted: 04.04.2020, 21:05
by miab3
Hi @timg11,
Connect ZConnection(activate it) with ZTable and see what TableName(s) are suggested.
Michal
Re: How to Install ZEOS.
Posted: 06.04.2020, 09:11
by marsupilami
Hello timg11,
timg11 wrote: ↑04.04.2020, 16:26
Thanks for the reply. The "subscription" on this forum doesn't seem to work - I did not receive any email notification of your response.
We had to disable email notification because Sourceforge doesn't allow sending emails anymore. If we wanted to send emails again we would have to move the forums.
timg11 wrote: ↑04.04.2020, 16:26I had some suggestions proposed. I completely uninstalled and deleted and started fresh, but created a new output directory for the Zeos packages.
That seemed to work.
Ok, that is good to know
timg11 wrote: ↑04.04.2020, 16:26I can set it to Postgresql-9 (I'm running v12 - hopefully it doesn't matter).
It doesn't matter. Zeos will behave the same for all PotgreSQL protocols. Indeed the protocol name "postgresql-9" is deprecated. It will not work on Zeos 7.3. I suggest you just use the "postgresql" protocol.
timg11 wrote: ↑04.04.2020, 17:11
I found
this thread regarding the DLL loading issue. It is for FreePascal, so maybe not relevant...
It suggested from providing these DLLs from version 12.1 (presumably 64 bit). libcrypto-1_1-x64.dll, libiconv-2.dll, libintl-8.dll, libpq.dll, libssl-1_1-x64.dll.
I copied them into the project, but got the same error. I have not used Freepascal recently, maybe it is now 64 bit?
Honestly I didn't look at the thread. But I can say this: FreePascal can create 32 bits and 64 bits Windows applications. So they can easily switch to 64 Bits and use the 64 Bits client library.
timg11 wrote: ↑04.04.2020, 17:11
So I copied all five of those DLLs from the version 10.12.2 32 bit binary ZIP file to the ZControlsExample project folder.
Now ZControlsExample will run and Connect without an Exception!
Good to know. One note about the client library: Of course you can use an older client library. This will work fine in most cases. Unfortunately the PostgreSQL people don't distribute a 32 bits library anymore. But I seem to remember that pgadmin is a 32 bits application and gets distributed with a current 32 bits build of the libraries. So you might wand to check if you can use that client library. Normally I use dependenca walker to see which libraries are loaded by libpq and distributre them with my application.
timg11 wrote: ↑04.04.2020, 18:59
I've solved the database name problem. After looking at the pgAdmin browser, I realized that the database is postgres, and testdata is a table. Changing the database to postgres and connecting now results in an SQL Error Exception "relation "cargo" does not exist - LINE 1:select * from cargo".
Please don't create tables and other objects in the postgres database. It is a system database with all the system objects. Please create your own database.
timg11 wrote: ↑04.04.2020, 18:59
I'm assuming the TZQuery objects ZCargo, ZDepartment, and ZPeople are expecting something from the database that doesn't exist in my case, so it is specific to the example project.
I'll have to see what else I can learn about the examples. But I think the libraries are working in any case.
You are right. Your connection works. In the examples directory there is a postgresql.sql file. It has the declarations for the tables that are necessary to run the example projects.
Best regards,
Jan
Re: How to Install ZEOS.
Posted: 24.05.2020, 21:14
by timg11
I'm working on this and wanted to explore the ZSimple example.
I told it to ignore the missing properties when loading. I copied the Postgress DLLs into the folder.
Then when compiling, there is an undefined Refresh_OLD_ID_SEQ error on the line in ZSimpleMain
Code: Select all
UpdateSQL.Refresh_OLD_ID_SEQ:=true;
Commenting that line out causes "internal error LA30" upon compiling, which leaves D7 unstable until restart.
What other adjustments are needed to cause Zsimple to work with ZeosLib 7.2.6.1?
PS - I did create a testing database in Postgresql using your example file postgresql.sql
It had the following errors when run:
Code: Select all
...snip....
INSERT 0 1
psql:C:/Data/DELPHI/ZeosLib/examples/postgresql.sql:131: ERROR: insert or update on table "people" violates foreign key constraint "people_p_dep_id_fkey"
DETAIL: Key (p_dep_id)=(3) is not present in table "department".
INSERT 0 1
...snip....
When I run ZControlsExample with this testing database, it now gets a different error:
Code: Select all
Project ZControlsExample.exe raised exception class EDatabaseError with message ZPeople: Type mismatch for field ID, expecting: SmallInt actual: Integer. Process stopped. Use Step or Run to continue.