Delphi connection to Sqlite with Zeos

Posted by Rahman M On Friday, August 10, 2012 9 comments
There are many Delphi components that can be used to interact with sqlite, one of the most popular is the ZEOS. It can be used for sqlite, ZEOS also be used to interact with some of the big servers like Oracle, MySQL, PostgreSQL and many more.

download first sqlite3.dll here and place it on the main project folder.

you can download the latest version of ZEOS here.
I assume you've installed ZEOS in delphi. here I am using Delphi 2009.
Now open your Delphi and create a new project and add components ZEOS,
TZConnection and TZQuery like this picture below.


double-click on the event onActivate Form1 and insert the following code.

procedure TForm1.FormActivate(Sender: TObject);
ZConnection1.Database:=ExtractFilePath(Application.ExeName) + '\coba.sdb';

//check connection
if ZConnection1.Connected=true then
  Application.MessageBox('connection successfully done','Checking connection',MB_ICONINFORMATION);
  Application.MessageBox('connection failed','Checking connection',MB_ICONSTOP);

do compile and see if we write code that worked?
yes, it should work like the image below.

in the next post we will add the data and view data in sqlite using the DBGrid. 


Никола Бъчваров said...
This comment has been removed by the author.
Никола Бъчваров said...

Thank you! It works - I tried with my Delphi7.

Anonymous said...

Delphi 2009 it works

AaEzha - Tutorial Internet dan Komputer said...

Ditunggu artikel selanjutnya :)

Anonymous said...

Not at all helpful.

You have a query which you do not use. What does this do apart from connect to a database?

Fajar Priyadi said...

Terimakasih Banyak

Fahmy Corporation (FREE Software) said...

Nice Share!

Kymberley Wilson said...

Works for me although there was a bit of messing around with field types before I could actually see and edit some.

Note that text = memo in Delphi and String is required to edit strings in a grid.

Jan Fenzlan said...

Jeszcze !!!Przykład otwarcia bazy i upchanie w TABELę GRID///

Post a Comment