[Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus?

Bo Berglund bo.berglund at gmail.com
Mon Aug 26 21:53:38 CEST 2019


I am going to write a small application to access a mySql database
from our website. The database has been exported to an SQL file and
imported into a local MariaDB running on a Raspberry Pi4 on our
network.

Now I want to access it from my Windows 7 environment via Lazarus (not
inside the editor but from a program written using Lazarus).

I am confused about the SQLDB component tab in the IDE since it lists
many connection components for MySql (7 in fact). Which one do I use?

I have used Lazarus and SQLDB for MsSQLServer with TMSSQLConnection,
but that is a single component...
What version of the TMySqlxxConnection shall I use towards a MariaDB?

The displayed version is:

$ mysql --version
mysql  Ver 15.1 Distrib 10.3.15-MariaDB, for debian-linux-gnueabihf
(armv8l) using readline 5.2

Does this by any chance indicate one should use a TMySql52Connection?
But then again that component does not exist on the palette...

A working fpc example towards a MariaDB database server would be
valuable!

I run Lazarus 2.0.4 with Fpc 3.0.4 on Windows 7 and on Raspberry Pi4,


-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list