MySQL Database for EF

Using MySQL DB instead of Derby DB

To use MySQL instead of Derby, please follow these steps:

  1. To install and configure the DB , please follow the documentation at https://docs.aws.amazon.com/enginframe/latest/ag/section-installation.html#mysql-version
    Note: If you do not know how to setup MySQL, please check: https://dev.mysql.com/doc/refman/8.0/en/linux-installation.html
  2. Download the respective JBDC connector for your Linux distro at https://dev.mysql.com/downloads/connector/j/
    • Extract the file and copy the jar file to $EF_ROOT/[version]/enginframe/WEBAPP/WEB-INF/lib/
      Remeber to change $EF_ROOT to enginframe base path. And [version] to your EnginFrame version.
      Note: If you installed the .deb or .rpm, probably the jar will be stored in:
      /usr/share/java/mysql-connector-java.jar
      /usr/share/java/mysql-connector-j.jar
  3. Edit the $EF_ROOT/conf/enginframe.conf DERBY_CONFIGURED:
    DERBY_CONFIGURED="false"
  4. Edit the file $EF_ROOT/conf/enginframe/server.conf and set the following parameters:
    ef.db.url=jdbc:mysql://[your_db_server_hostname]:3306;databaseName=EnginFrameDB;
    ef.db.admin.name=enginframedb
    ef.db.admin.password=efdbpassword
  5. Restart the EnginFrame
    systemctl restart enginframe
  6. Then check the systemd logs:
    journalctl -u enginframe.service

Important: If you created a database with character set different of latin1, you need to fix that:
ALTER DATABASE EnginFrameDB CHARACTER SET=’latin1′

You can review this configuration with the command below (check character_set_database):

MariaDB [EnginFrameDB]> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+

Using MariaDB over Derby

You can follow the same MySQL procedure.

To setup MariaDB, you can download and install with this script (for any Linux distro):

curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash