[Lazarus] How to connect to MariaDB/mySql database from fpc/Lazarus?
Michael Van Canneyt
michael at freepascal.org
Mon Aug 26 23:39:47 CEST 2019
On Mon, 26 Aug 2019, Bo Berglund via lazarus wrote:
> 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?
TMySQL57Connection.
>
> 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?
See above.
>
> 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...
No, see above.
If I may suggest:
If you have a choice of database, choose something else.
MariaDB/MySQLDB are the probably the worst choices you can make.
Postgres, Firebird, SQLIte: all better choices, depending on your use case.
Michael.
More information about the lazarus
mailing list