Compatibility Mode Configuration
The Halo database supports three compatibility modes: Oracle, MySQL, and PostgreSQL. The PostgreSQL mode requires no additional configuration, while the Oracle and MySQL modes are enabled through configuration parameters.
Enabling Methods
Halo provides two ways to enable compatibility modes:
| Method | Parameter | Applicable Version | Features |
|---|---|---|---|
| New method (recommended) | cluster_net_services | Halo 16 | Supports multiple modes running simultaneously, differentiated by port |
| Legacy method | database_compat_mode | Halo 14 | Only one compatibility mode can be set at a time |
Halo 16 still supports the legacy method (
database_compat_mode), but the new method is recommended for multi-mode coexistence.
Oracle Compatibility Mode
New Method (Recommended)
Modify $PGDATA/postgresql.conf:
cluster_net_services = ':1521:oracle'
Restart and create the extension:
pg_ctl restart
psql -c "create database oracle;"
hsql -d oracle -p 1521 -c "create extension aux_oracle cascade;"
Legacy Method (Halo 14)
Modify $PGDATA/postgresql.conf:
database_compat_mode = 'oracle'
Restart and create the extension:
pg_ctl restart
psql -d your_database -c "create extension aux_oracle cascade;"
In Oracle mode, the
aux_oracleextension must be created to use Oracle syntax.
MySQL Compatibility Mode
New Method (Recommended)
Modify $PGDATA/postgresql.conf:
cluster_net_services = ':3306:mysql'
mysql.default_tenant = 'mysql'
Related MySQL parameters:
| Parameter | Description | Default |
|---|---|---|
| mysql.default_tenant | Specifies the default MySQL mode database | empty |
| mysql.max_allowed_packet | Maximum packet size | 4MB |
Restart and create the extension:
pg_ctl restart
psql -c "create database mysql;"
psql -d mysql -c "create extension aux_mysql cascade;"
Set up the MySQL application user:
psql
SET password_encryption='mysql_native_password';
CREATE USER mysqltest SUPERUSER PASSWORD '123456';
Connection test:
# If mysql.default_tenant is set
mysql -h xxx.xxx.xxx.xxx -d xxx -u mysqltest -p
# If mysql.default_tenant is empty
mysql -h xxx.xxx.xxx.xxx -d xxx -u mysqltest@dbname -p
Legacy Method (Halo 14)
Modify $PGDATA/postgresql.conf:
database_compat_mode = 'mysql'
second_listener_on = true
second_port = 3306
Restart and create the extension:
pg_ctl restart
In MySQL mode, a MySQL database corresponds to a schema. You only need to create a schema under the halo0root database. After creating new tables, you need to grant permissions to the target user.
PostgreSQL Compatibility Mode
The Halo database is natively compatible with the PostgreSQL protocol and syntax. No additional configuration is required. After installation, you can connect directly using standard PostgreSQL clients (such as psql, JDBC).
In a multi-mode coexistence scenario, you can explicitly specify a port for PostgreSQL mode using cluster_net_services:
cluster_net_services = ':5432:postgresql,:1521:oracle,:3306:mysql'
Multi-Mode Compatibility
Multiple modes can be configured simultaneously, separated by commas ,:
cluster_net_services = ':5432:postgresql,:1521:oracle,:3306:mysql'
mysql.default_tenant = 'mysql'
Each mode is accessed independently through its own port without interference.