Sign in Join
Wiki copytemporary

Zeos tutorial: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Overview
22
33This tutorial is about getting, installing and using [Zeoslib](http://zeos.firmos.at/portal.php) with [[Glossary|Lazarus]] and [[Glossary|FPC]].
44
55# Getting Zeos
66
77Zeos has recently been ported to [[Glossary|Lazarus]] and there are no releases yet that officially support it but you can easily get it from SVN if you follow these steps:
88
99## SVN
1010
1111### Windows
1212
1313- get a SVN client [TortoiseSVN](http://tortoisesvn.tigris.org) and install
1414- see [Getting Started with TortoiseSVN](http://tortoisesvn.net/docs/release/TortoiseSVN_en/help-onepage.html#tsvn-dug-general)
1515- do Checkout from Windows Explorer: <http://svn.code.sf.net/p/zeoslib/code-0/trunk>
1616
1717### Linux/BSD
1818
1919- [[Portal:FreeBSD|FreeBSD]] comes with *'svnlite* (an svn client) preinstalled
2020- get an SVN client (esvn, kdesvn, etc.)
2121- create zeosdbo directory, go in that directory and do
2222- svn checkout <http://svn.code.sf.net/p/zeoslib/code-0/trunk>
2323
2424## ZIP
2525
2626You can download the latest version as a ZIP file from sourceforge.net:
2727
2828- [<http://sourceforge.net/projects/zeoslib/>](http://sourceforge.net/projects/zeoslib/)
2929
3030# Installing the components
3131
3232This is a tricky part so you should have a little patience and read this part carefully.
3333
3434- Make sure you have the latest [Lazarus snapshot](http://www.de.freepascal.org/lazarus/) and the at least FPC 2.0.3 not older than 6th March 2006.
3535- Start one instance of Lazarus.
3636
37371. Use **Components/Open Package File(.lpk)** from the main menu.
38382. Go to **zeosdbo_rework\packages\lazarus\** and open **zcomponent.lpk**. Note: Starting with Zeos 7.3 / 8.0 Zeos has a new zcomponentdesign package for Lazarus. Please use this package on these versions.
39393. Press **\[Compile\]** only if you don't want to install the components into the IDE
40404. Press **\[Install\]**
41415. You are asked if you want to recompile Lazarus.
4242
4343- Answer **\[Yes\]** this time.
4444- Wait until compilation ends, Lazarus should restart itself after that.
4545- If all is ok you should now be able to see the **\[Zeos Access\]** tab in the Component Palette.
4646
4747![](/wiki-images/2/25/Zeos_Components.png)
4848
4949If you receive the error "Cannot find unit ZClasses" or something similar, then you need to carefully check the case of the filenames in your Zeos source distribution.
5050
5151- Even if the cases match exactly, the autogenerated package source file can generate the wrong case name in the uses clause (Lazarus 0.9.18), i.e.:
5252
5353``` pascal
5454{ This file was automatically created by Lazarus. Do not edit!
5555 This source is only used to compile and install the package.
5656}
5757unit Zcore;
5858interface
5959uses
6060 Zclasses, Zcollections, Zcompatibility, Zexprparser, Zexprtoken, Zexpression,
6161 Zfunctions, Zmatchpattern, Zmessages, Zsysutils, Ztokenizer, Zvariables,
6262 Zvariant;
6363implementation
6464end.
6565```
6666
6767- Notice that Lazarus has named the unit ZClasses Zclasses, resulting in a naming conflict. Presumably this is a bug in Lazarus, not the Zeos packages. One way around this is to rename all the zeos source files to lowercase. Trawl through each subdirectory under src/ and execute this command in a bash window:
6868
69-` rename -v 'y/A-Z/a-z/' *`
69+```text
70+ rename -v 'y/A-Z/a-z/' *
71+```
7072
7173- Then, in Lazarus, reopen the package (.lpk) and fix the filename cases by clicking on "More..."/"Fix Files Case"
7274- The package should compile now.
7375
7476# Installing Zeos components in MSEide
7577
7678In order to install the Zeos components:
7779
7880- add the path to the Zeos source to 'Project'-'Options'-'Make'-'Directories'
7981- and compile the IDE with **-dmse_with_zeoslib -dMSEgui**.
8082- There is a predefined IDE project **apps/ide/mseide_zeos.prj**, update 'Project'- 'Options'-'Macros' according to your installation.
8183- A simple demo is in [mseuniverse](https://github.com/mse-org/mseuniverse/tree/main/samples/db/zeos).
8284
8385# Make your first Zeos application
8486
8587- Drop a **ZConnection**.
8688 - Set your User, Password, Host, Port and Protocol (and any other params if needed).
8789 - Set Connected to True.
8890
8991- Drop a **ZQuery** (do not mistake with ZReadOnlyQuery).
9092 - Set the Connection to your active ZConnection.
9193 - Set the Sql property to something like **SELECT * FROM MyTable**
9294 - Set Active to True.
9395
9496- Drop a **DataSource** from the **\[Data Access\]** tab.
9597 - Set the DataSet to your active ZQuery.
9698
9799- Drop a **DBGrid** from the **\[Data Controls\]** tab.
98100 - Set the Datasource to your DataSource.
99101 - If all is ok you should now be able to see the records from your table.
100102
101103# Possible Bugs and Issues
102104
103105- I have noticed that sometimes when building Lazarus it cannot find some Zeos files, as a quick workaround try this:
104106 - Use **Components/Package Graph** from the main menu.
105107 - Open the **ZComponent** package.
106108 - Right Click on the **Files** item in the list.
107109 - Choose **\[Recompile all required\]**.
108110 - When asked "Re-Compile this and all required packages?" answer **\[Yes\]**.
109111 - Recompile Lazarus normally (with packages).\
110112 \
111113
112114# See also
113115
114116- [Forum for ZeosLib](http://zeoslib.sourceforge.net/index.php)
115117- [[ZeosDBO]]
116118- [Tutorial Lazarus/Zeos/Firebird (Windows)](https://lazarus.intern.es/tutorial_firebird_lazarus_zeos_2.html) German/Parts in English [download site](https://lazarus.intern.es/download_tutorials_lazarus_zeos_firebird.html)
117119
118120---
119121*From the Free Pascal wiki, page "Zeos tutorial", as it stood on 2022-03-28 after a change by Marsupilami, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history