Recent

Author Topic: dBase in Lazarus  (Read 1804 times)

compispezi@web.de

  • New member
  • *
  • Posts: 5
dBase in Lazarus
« on: August 09, 2022, 03:46:46 pm »
Hi friends. I'm a beginner. That means, these are my first steps after a pause of 15 years. I would like to use simple databasestructures without client-Serverfunction.
A very good way was to use dBase in an older Delphi 7 version.

Is here a way to work with dbase structures in Lazarus (create database / add / edit / sql...) ?

Thank you very much

Zvoni

  • Hero Member
  • *****
  • Posts: 1335
Re: dBase in Lazarus
« Reply #1 on: August 09, 2022, 04:10:47 pm »
Do yourself a favour, and forget DBase.

Use SQLite.

And FWIW: There is a Sub-Forum called "Databases"...... ..oO(now what could this be for?)
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

compispezi@web.de

  • New member
  • *
  • Posts: 5
Re: dBase in Lazarus
« Reply #2 on: August 09, 2022, 04:19:42 pm »
Hi Zvoni, in the past i used dBase in all projects.

SQLite ist a single component without server needed?

Zvoni

  • Hero Member
  • *****
  • Posts: 1335
Re: dBase in Lazarus
« Reply #3 on: August 09, 2022, 04:40:26 pm »
Hi Zvoni, in the past i used dBase in all projects.

SQLite ist a single component without server needed?
Correct. The only thing you‘d need is the sqlite-library/dll placed in the same folder as your executable
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Handoko

  • Hero Member
  • *****
  • Posts: 4712
  • My goal: build my own game engine using Lazarus
Re: dBase in Lazarus
« Reply #4 on: August 09, 2022, 05:07:25 pm »
Lazarus has TDBF component installed by default but you have to enable it first:
Lazarus main menu > Package > Install/uninstall packages > Available for installation > type: DBFLaz 0.1.1 > Save and rebuild IDE > wait and the IDE will be restarted

TDBF is very easy to use similar to DBase, zero installation on the user computer and no *.dll file needed. This is the tutorial for TDBF:
https://wiki.lazarus.freepascal.org/Lazarus_Tdbf_Tutorial

I use it in my personal note taking program and a small inventory software I wrote many years ago. They're working good, no problem so far.

But TDBF is not suitable for multi-client environment. If you need to store huge amount of data or performance is important, you should consider to use the other options:
https://wiki.lazarus.freepascal.org/Databases#Supported_databases

I ever roughly tested the SQLite, it is about 4 times faster than TDBF. Currently I am learning Firebird, which is similar to SQLite but it has some advantages.
https://wiki.lazarus.freepascal.org/Firebird

Firebird basically means free but if you modify the source code, you need to comply to their license. SQLite is in Public Domain license.

Also TDBF may have licensing issue, read here:
https://forum.lazarus.freepascal.org/index.php/topic,60100.msg448769.html#msg448769
« Last Edit: August 09, 2022, 05:21:52 pm by Handoko »

Thaddy

  • Hero Member
  • *****
  • Posts: 11897
Re: dBase in Lazarus
« Reply #5 on: August 09, 2022, 05:09:01 pm »
Hi Zvoni, in the past i used dBase in all projects.

SQLite ist a single component without server needed?
Correct. The only thing you‘d need is the sqlite-library/dll placed in the same folder as your executable
Not quite correct/complete, since Sqlite can be statically linked too if so required.
Black themes should be banned.

Handoko

  • Hero Member
  • *****
  • Posts: 4712
  • My goal: build my own game engine using Lazarus
Re: dBase in Lazarus
« Reply #6 on: August 09, 2022, 05:20:07 pm »
Yes, I had done some research about static linking SQLite. Not easy. That requires recompiling the source code to produce static library. Unfortunately, I'm not familiar with C.

wp

  • Hero Member
  • *****
  • Posts: 10031
Re: dBase in Lazarus
« Reply #7 on: August 09, 2022, 05:39:30 pm »
Hi friends. I'm a beginner. That means, these are my first steps after a pause of 15 years. I would like to use simple databasestructures without client-Serverfunction.
A very good way was to use dBase in an older Delphi 7 version.

Is here a way to work with dbase structures in Lazarus (create database / add / edit / sql...) ?
I would not recommend to follow the advice of the others to use sqlite. Too much for a beginner in the Lazarus world. Maybe later, when you've succeeded with your first steps.

Use the TDbf component which is installed by default and does not require any third-party libraries. It is NOT a replacement for the BDE (which is not supported by Lazarus), but it can open dbase files, and maybe you can port most of your old Dephi7/DBase projects by using it. There is a wiki tutorial at https://wiki.freepascal.org/Lazarus_Tdbf_Tutorial to get you started.

af0815

  • Hero Member
  • *****
  • Posts: 1021
Re: dBase in Lazarus
« Reply #8 on: August 09, 2022, 08:00:12 pm »
TDBF use no SQL. As wp said, no replacement for the BDE. If you have used the BDE with SQL, SQlite can be a leightweigth solution. If you want to work across (Windows File)shares , the discussion is more complex.

And client/Server is not the same as SQL. The better Term is Desktop Database vs. Client Server.
« Last Edit: August 09, 2022, 08:04:42 pm by af0815 »
regards
Andreas

winni

  • Hero Member
  • *****
  • Posts: 3134
Re: dBase in Lazarus
« Reply #9 on: August 09, 2022, 10:29:59 pm »
Hi!

TDBF comes with a lot of problems.

What I did a long time ago:

Use TBDF to export the dBase tables to CSV
And then forget dBase forever

Import the CSV data to any SQL db that you like.

Winni

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1079
Re: dBase in Lazarus
« Reply #10 on: August 10, 2022, 11:15:04 am »
If you want to do something, anything, with a current database, you need to use SQL. SQLite makes that as painless as possible. Making an SQLite editor in Lazarus is 5 minutes work.

(Well, ok, there are NoSQL databases if you want it to be huge/scalable.)

korba812

  • Sr. Member
  • ****
  • Posts: 304
Re: dBase in Lazarus
« Reply #11 on: August 10, 2022, 11:28:17 am »
Try Advantage Database - works with DBF files and has SQL. It is free for desktop applications.
https://wiki.freepascal.org/Advantage_Database_Server

iret

  • New Member
  • *
  • Posts: 10
Re: dBase in Lazarus
« Reply #12 on: August 14, 2022, 06:25:24 pm »


TDBF comes with a lot of problems.



Hi Winni,

can you be a little bit more specific: Are the problems only related to index files or has TDbf general issues with reading/writing dbase files?

Best regards,
 
  Stefan

Handoko

  • Hero Member
  • *****
  • Posts: 4712
  • My goal: build my own game engine using Lazarus
Re: dBase in Lazarus
« Reply #13 on: August 14, 2022, 06:43:51 pm »
TDBF should have no problem if you only use it on a local computer and connected by only one single access.

I have 2 programs using TDBF, never have any issue with it. A small stock control program, which has been running for more than 10 years written using Lazarus version 0.9x if I remember correctly. The user only contacted me once, because he purchased a laptop and wanted me to copy the program to the laptop. And the second one is my personal note-taking program, which I have been using it for more than 3 years.

iret

  • New Member
  • *
  • Posts: 10
Re: dBase in Lazarus
« Reply #14 on: August 14, 2022, 06:57:43 pm »
Hmm, I thought I could share a dbf file with one of my old Delphi BDE programs which I can not replace right now.

Using TDbf seems to be working, but sometimes (e.g once a day) I get strange errors which seem to be related to a damaged index file.


Maybe I have to write a Delphi Dll now to access the dbase files.

 

TinyPortal © 2005-2018