Author Topic: Databases  (Read 705 times)


  • New Member
  • *
  • Posts: 11
« on: June 22, 2020, 05:57:49 pm »

A question concerning database applications

I have to provide some enhancements to some Delphi applications which were written more than 20 years ago.I thought I would try to do this using Lazarus. The data tables in these applications are mainly dBase DBF files with (possibly) some Paradox files. Some of the applications use local dbf files i.e they are on one PC only.

Now, I am new to Lazarus and my question is: -
Using Lazarus can I connect Forms to local dBase dbf tables? and if so how do I do it?
Which dataset and which datasource do I use? Any information regarding this would be useful.

Many Thanks


  • Sr. Member
  • ****
  • Posts: 283
Re: Databases
« Reply #1 on: June 22, 2020, 06:32:37 pm »
please read this wiki arctile
There are some limitations for DBF, Paradox and FoxPro db.

You need to install DBFLaz package from your Lazarus installation.

From Data Access pallete put into Form TDBF and Datasource components. Set the FilePath property of TDBF. Choose the TDBF in DataSet property from DataSource. Then from Data Control pallete put into Form for example TDBGrid compenent and set it DataSource property.

I recommend your to convert your single user databases to something modern, for example SQLite or Firebird embeded.
« Last Edit: June 23, 2020, 12:24:47 pm by mig-31 »
Lazarus 2.0.6 - CentOS 7.x, Mageia 7.1


  • Sr. Member
  • ****
  • Posts: 429
Re: Databases
« Reply #2 on: June 23, 2020, 12:15:36 pm »
I recommend to your to convert your single user databases to something modern, for example SQLite or Firebird embeded.
Seconded for SQLite!
In case you need to "save/transfer" existing live-data, IIRC, you can open/import DBase-Files in Excel, then export it from there into CSV or whatever.
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
People call me crazy, because i'm jumping out of perfectly fine aircraft


  • Hero Member
  • *****
  • Posts: 2145
    • Lazarus and Free Pascal italian community
Re: Databases
« Reply #3 on: June 23, 2020, 12:19:59 pm »
I advise you to convert your project to Firebird. So in addition to using the SQL engine, you can make that data available to other clients in the future.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1


  • Hero Member
  • *****
  • Posts: 4007
  • My goal: build my own game engine using Lazarus
Re: Databases
« Reply #4 on: June 23, 2020, 12:48:03 pm »
Using Lazarus to connect dbf tables is super easy, I ever wrote some programs using Lazarus - dbf. But just like others suggest, you should consider other better alternatives. Quick and easy, use dbf but for long time investment use the others.

Database video tutorials:

How to load dbf data (to a string grid), try this example:,37181.msg249361.html#msg249361

Lazarus-supported databases:

Lazarus database portal:
« Last Edit: June 23, 2020, 12:54:18 pm by Handoko »


  • Hero Member
  • *****
  • Posts: 7926
Re: Databases
« Reply #5 on: June 23, 2020, 01:26:02 pm »
I agree with Handoko. Since you are new to Lazarus and want to convert old Delphi programs you'll have to fight enough with the differences. It does not make sense to change the database in the same step. So, stick with TDbf to get started. Later, when the Laz-Delphi conversion is done, you still can try to change the database.

For reading Paradox you have two options: either use TParadox which comes with FPC (you must install the package (lazarus)/components/paradox/lazparadox.lpk) or TParadoxDataset (; install it via Online-Package-Manager). I was more successful with the latter one since it does not depend on any other library (unlike TParadox). Note, however, that it is only good for reading!
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...


TinyPortal © 2005-2018