Databases
Work in progress..
Introduction
This page is about creating databases applications with Lazarus using the DB-unit. In the DB unit all the basic functionality for working with databases is implemented, but to be usefull they need components which are dependent on the database you want to use.
The first part gives a short introduction on the several database-dependent components and how to install them, the second part is a short course in working with the DB-unit and the last part gives specific information about several supported databases.
First Part: General information about supported databases
Introduction
The databases you can use with Lazarus, (actually with FPC, but that's not so important for the rest of the story) can be divided into two categories: The databases which are completely 'internal' and are written in Freepascal, and the 'external' databases to which connections are made with client-libraries. To use these client-libraries the appropiate bindings must be available. Most client-libraries come only with bindings for C, but FPC provides several packages with the pascal-bindings for database-clients. The supported databases are listed in table 1. (fpc 1.9.7 and above)
Table 1
Database | Package name | Need Client Lib? | Supported versions | Supported platforms |
---|---|---|---|---|
DBase | tDbf | No | - | All |
In memory | memds | No | - | All |
Textfiles | sdf | No | - | All |
Interbase | IBase | Yes | 4 - 6 | i386: Linux, Win32 |
Firebird | IBase | Yes | 1 - 1.5 | i386: Linux, Win32 |
SQLite | SQLite | Yes | - | - |
PostgreSQL | postgres | Yes | 6.6 - 8 | i386: Linux, Win32 |
Oracle | Oracle | Yes | - | - |
ODBC | ODBC | Yes | - | i386: Win32 |
MySQL | MySQL | Yes | 3 - 4.0 | i386: Linux, Win32 |
The bindings to the database-clients
If you want to use one of the databases-client libraries, those libraries has to be installed. Not only on the computer where you're programming on, but also on the computes where the application must run at. Not that some databases (in particular MySQL) only work if the bindings which are compiled in the application are from the same version as those of the installed libraries. How to install those libraries (.so files on *nix systems, and .dll's on windows) you can find on the website of the database-developers.
The database-components in Lazarus
Using the components in the DB unit
This section gives a short tutorial which holds for all the databases based on the db unit. Before