Getting Started
Database Compatibility
Trongate's Model class utilizes PDO (PHP Data Objects) for database interaction, a robust library included in most PHP installations. PDO supports a variety of databases:
- MySQL
- MariaDB
- PostgreSQL
- Oracle
- Firebird
- MS SQL Server
- Sybase
- Informix
- FreeTDS
- SQLite
- Cubrid
- 4D
Trongate has been tested extensively using MySQL and MariaDB. While interaction with other database types (such as those listed above) is technically possible, guidance or examples for other databases (such as PostgreSQL, Oracle, etc.) will not be covered in this chapter.
The Database Configuration File
Trongate establishes database connections using a configuration file named database.php, located in the 'config' directory of your web application.
The configuration settings will vary depending on your setup and chosen database. Below is an example configuration for a database named 'waterways' hosted locally:
<?php
// Database settings
define("HOST", "127.0.0.1");
define("PORT", "3306"); // Default MySQL port
define("USER", "root");
define("PASSWORD", "");
define("DATABASE", "waterways");
The 'PORT' setting is optional in many cases. If your database server uses the default port (3306 for MySQL), you typically do not need to specify it explicitly in your configuration. However, if your database server runs on a different port or if you encounter connection issues, specifying the correct port number becomes necessary.