Database Configuration
The Motels plugin supports multiple database options to store and manage motel data. You can choose between local storage (SQLite or H2) or an external MySQL database.
Configuration
The database configuration is managed in the config.yml
file. Here's a breakdown of the available options:
Local Database Options
By default, the plugin uses a local database for data storage. You can choose between SQLite and H2 databases.
use-sqlite
: Set totrue
to use SQLite, orfalse
to use H2 database.
When using a local database:
SQLite database file will be created as
database.sqlite
in the plugin's data folder.H2 database files will be created with the prefix
localdb
in the plugin's data folder.
External MySQL Database
To use an external MySQL database, you need to configure the following settings:
Set
mysql.enabled
totrue
.Choose between development and production database configurations:
Set
mysql.development
totrue
for development database,false
for production.
Development Database Configuration
Production Database Configuration
Replace the values with your actual MySQL server details.
Connection Pool
The plugin uses HikariCP for efficient database connection pooling. Some notable settings:
Maximum pool size: 10 connections
Auto-reconnect: enabled
SSL: disabled
Important Notes
When switching between database types (local to MySQL or vice versa), ensure you have a proper data migration strategy in place to prevent data loss.
For MySQL connections, the plugin uses the JDBC URL format:
The plugin will log the database type it's using on startup:
"Using MySQL development database."
"Using MySQL production database."
"Using local database."
If you encounter any database connection issues, check the server console for error messages. The plugin will log any database startup errors.
When the server shuts down or the plugin is disabled, the database connection will be properly closed to prevent resource leaks.
By configuring these options, you can choose the most suitable database setup for your server environment, whether it's a local SQLite/H2 database for simpler setups or a MySQL database for more complex, multi-server configurations.
Last updated