Skip to main content
Version: 1.0.16

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:

MethodParameterApplicable VersionFeatures
New method (recommended)cluster_net_servicesHalo 16Supports multiple modes running simultaneously, differentiated by port
Legacy methoddatabase_compat_modeHalo 14Only 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

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_oracle extension must be created to use Oracle syntax.

MySQL Compatibility Mode

Modify $PGDATA/postgresql.conf:

cluster_net_services = ':3306:mysql'
mysql.default_tenant = 'mysql'

Related MySQL parameters:

ParameterDescriptionDefault
mysql.default_tenantSpecifies the default MySQL mode databaseempty
mysql.max_allowed_packetMaximum packet size4MB

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.