lazarus + firebird embedded step by step project (`Hello World tutorial`) //Win32
apps, lazarus, pascal Add comments1. Download Lazarus and isntall
2. Download and install FireBird
3. Create DB (hellodb.fdb) :
SET NAMES UTF8;
CREATE DATABASE 'PATH_TO_DB\HelloDB.fdb'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 16384
DEFAULT CHARACTER SET UTF8;
CREATE TABLE TBL_HELLO (TXT_FIELD CHAR(1000))
// or grab my one here
// for manage DB you can use IBExpert
3. Download ZeosDBO (Component for connecting to multiple database)
3.1 packages/lazarus/ZCore.lpk – Open/Compile
3.2 packages/lazarus/ZParseSql.lpk – Open/Compile
3.3 packages/lazarus/ZPlain.lpk – Open/Compile
3.4 packages/lazarus/ZDbc.lpk – Open/Compile
3.5 packages/lazarus/ZComponent.lpk – Open/Compile/Install
4. Open Lazarus and create new project ‘HelloWorld’ and save it.
5. From ‘Zeos Access’ tab, drag TZConnection and TZTable component to project

6. Configure TZConnection properties
// Database – PATH to HelloDB.fdb
// Hostname – localhost ( for embedded project this field must be blank)
// Protocol – choose your database server and version (mine is firebirdd-2.1)
// User – SYSDBA (default FireBird username)
// Password – masterkey (default FireBird password)
// Connected – set to TRUE (now you are connected to your database)
if you getting error about missing dll`s,
then copy fbclient.dll from Firebird bin directory
to Windows System32 and rename it to: fbclientd.dll

7. Configure TZTable properties
//Connection – choose ZConnection1
//TableName – choose TBL_HELLO
//Active- set True

8. From Data Access tab drag in project TDatasource component
// Set DataSet property to ZTable1

9. From Data Controls tab drag in project TDBnavogator
// Set Align property to alBottom
// Set DataSource property to Datasource1

10. From Data Controls tab drag in project TDBGrid
// Set Align property to alClient
// Set DataSource property to Datasource1
//Set AutoFillColumns to True
11. Build / Run project. Now you can insert Hello World text in database.

Project still not running with embedded server, lets download Firebird embedded and change project for embedded work.
12. Set TZConnection property Connected to False.
Add some code to OnCreate event for Form

ZConnection1.Database:=ExtractFilePath(Application.EXEName)+'HELLODB.FDB'; //Set path to DB file (directory where is HelloWorld.exe)
ZConnection1.Connect; // open connection
ZTable1.Active:=true; // open connection
13. Build project.
14. From project map copy to seperate map (For example: HelloWorld_embedded) :
HelloWorld.exe
HELLODB.FDB
15. Download Firebird embedded, separate download, zip kit.
16. Copy dll files from embedded server map to HelloWorld_embedded map
fbembed.dll
ib_util.dll
icudt30.dll
icuin30.dll
icuuc30.dll
17. Rename fbembed.dll to fbclientd.dll
18. Thats all, now you can stop/uninstall Firebird server,
just run HelloWorld.exe and you have application with fully functional embedded SQL server.
3 Responses to “lazarus + firebird embedded step by step project (`Hello World tutorial`) //Win32”
Leave a Reply
You must be logged in to post a comment.



June 4th, 2009 at 10:58
Well done.
You’ve just exposed a couple of really well-kept secrets surrounding development / databases.
It’s a good thing, of course.
Lazarus (FREE platform independent “Delphi” ). Firebird (FREE, platform independent). Zeos (FREE wow). IBExpert (There is a free version that’s awesome). The FB Embedded SQL server (most people don’t realise the benefits of this yet).
ZeosDB is stable IMHO for amongst others MySQL development (I use it from Delphi 2006) and we’ve been using Firebird embedded (and server mode) for many years…
June 4th, 2009 at 12:23
Nice tutorial.
It can even be done with the built-in database connection components.
(TIBConnection), so there is no need to install ZeosDB if you’re a bit anxious to recompile the IDE.
Of course, using ZeosDB is great too.
August 31st, 2009 at 02:38
Has anyone got this working on a Mac.
I would like to run the embedded version, but I cannot figure out what files (*.dll on a PC) that the Mac needs.
I am new to the mac world.
Tom