Database Switch
Important Note for Migration from H2 database
Please make sure to use H2 database driver v1.4.196 for correct connection to the existing database to pull data from.
The database h2-1.4.196.jar driver is located in activitytimeline/webapps/ROOT/WEB-INF/lib folder.
MySQL database
- Case: ActivityTimeline is configured to use H2 database by default. A customer would like to migrate it to their MySQL database.
- Q: Could you send directions for doing this?
- A: Here is the documentation regarding switching a database engine:
- ActivityTimeline is pre-configured to use built-in H2 database.
- Open activitytimeline/webapps/ROOT/WEB-INF/classes/configuration.properties file and edit it if you'd like to change a database engine to MySQL.
- Make sure MySQL database was installed on your server before and has "timeline" database created.
- It is also required that “timeline” database uses UTF8 character set by default.
- Replace everything in configuration.properties file with the following data to connect to MySQL database:
MySQL Database connection URL
dataSource.url=jdbc:mysql://<MySQL_HOST>:<MySQL_PORT>/<MySQL_DATABASE_NAME_FOR_ACTIVITYTIMELINE> dataSource.url=jdbc:mysql://127.0.0.1:3306/timeline?autoReconnect=true&autoreconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
MySQL Database username
dataSource.username=at_user
MySQL Database password
dataSource.password=at_password
Other properties
dataSource.pooled=true dataSource.driverClassName=com.mysql.jdbc.Driver dataSource.dbCreate=update # MySql 5.5, 5.6, 5.7: dataSource.dialect=com.timeline.hibernate.ActivityTimelineMySQLDialect # MySql 8.0+: # dataSource.dialect=com.timeline.hibernate.ActivityTimelineMySQL8Dialect
- Replace at_user and at_password with actual username/password combination of your MySQL database user.
Restart ActivityTimeline afterwards.
If you would like to migrate existing data from H2 database to MySQL, then you would need to use an external tools to migrate the database data like SQuirreL SQL with SQuirreL DB Copy Plugin (first you need to install SQuirreL SQL and on top of that the SQuirreL DB Copy Plugin). Also, you may need to start ActivityTimeline on an empty external database (schema) first for ActivityTimeline to create all required tables and relations.
H2 database files are located at activitytimeline/bin/atdb folder.
IMPORTANT: Upgrade to MySQL v8.0+MySQL 8.0 and above have "lead", "rank" and few other words reserved and cannot be used as column names.As a result it is required to perform a specific procedure to upgrade MySQL to v8.0.Open <AT_FOLDER>/activitytimeline/webapps/ROOT/WEB-INF/classes/configuration.properties file for editing and add the following line:
dataSource.dialect=com.timeline.hibernate.ActivityTimelineMySQL8Dialect
- Save it.
- Alter database structure (see below)
- Restart ActivityTimeline.
You should alter the MySQL 5.6/5.7 ActivityTimeline database schema before the upgrade to MySQL 8.0:- Column "rank" of "issue" table should be renamed to "issue_rank"
- Table "level" should be renamed to "knowledge_level"
- Table "priority" should be renamed to "rlx_at_priority"
- Rename the following columns of "project" table:
- "priority" to "prj_priority"
- "active" to "prj_active"
- "lead" to "prj_lead"
- Rename the following columns of "worklog_record" table:
- "date" to "worklog_date"
- "comment" to "worklog_comment"
PostgreSQL database
- Case: ActivityTimeline is configured to use H2 database by default. A customer would like to migrate it to their PostgreSQL database.
- Q: Could you send directions for doing this?
# PostgreSQL Database connection URL
dataSource.url=jdbc:postgresql://localhost:5432/timeline?autoReconnect=true&autoreconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
# PostgreSQL Database username
dataSource.username=at_user
# PostgreSQL Database password
dataSource.password=at_password
# Other properties
dataSource.pooled=true
dataSource.driverClassName=org.postgresql.Driver
dataSource.dbCreate=update
.
If you would like to migrate existing data from H2 database to PostgreSQL, then you would need to use an external tools to migrate the database data like SQuirreL SQL with SQuirreL DB Copy Plugin (first you need to install SQuirreL SQL and on top of that the SQuirreL DB Copy Plugin). Also, you may need to start ActivityTimeline on an empty external database (schema) first for ActivityTimeline to create all required tables and relations.
H2 database files are located at activitytimeline/bin/atdb folder.
MS SQL Server database
- Case: ActivityTimeline is configured to use H2 database by default. A customer would like to migrate it to their MSSQL database.
- Q: Could you send directions for doing this?
# MS SQL Server Database connection URL
# Structure: dataSource.url=jdbc:jtds:sqlserver://;serverName=<MSSQL_HOST>;portNumber=<MSSQL_PORT>;databaseName=<MSSQL_DATABASE_NAME_FOR_ACTIVITYTIMELINE>;integratedsecurity=false;socketTimeout=60000
dataSource.url=jdbc:sqlserver://;serverName=localhost;portNumber=1433;databaseName=timeline;integratedsecurity=false;socketTimeout=60000
# MSSQL Database username
dataSource.username=at_user
# MSSQL Database password
dataSource.password=at_password
# Other properties
dataSource.pooled=true
dataSource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
dataSource.dialect=com.timeline.hibernate.ActivityTimelineMSSqlServerDialect
dataSource.dbCreate=update
# -------------------------------------------------
# Or Alternative jTDS MSSQL driver
# Alternative MSSQL Database connection URL - jTDS driver
# Structure: dataSource.url=jdbc:jtds:sqlserver://<MSSQL_HOST>:<MSSQL_PORT>;databaseName=<MSSQL_DATABASE_NAME_FOR_ACTIVITYTIMELINE>
dataSource.url=jdbc:jtds:sqlserver://localhost:1433;databaseName=timeline
# MSSQL Database username
dataSource.username=at_user
# MSSQL Database password
dataSource.password=at_password
# Other properties
dataSource.pooled=true
dataSource.driverClassName=net.sourceforge.jtds.jdbc.Driver
dataSource.dialect=org.hibernate.dialect.SQLServerDialect
dataSource.dbCreate=update
If you would like to migrate existing data from H2 database to MSSQL, then you would need to use an external tools to migrate the database data like SQuirreL SQL with SQuirreL DB Copy Plugin (first you need to install SQuirreL SQL and on top of that the SQuirreL DB Copy Plugin). Also, you may need to start ActivityTimeline on an empty external database (schema) first for ActivityTimeline to create all required tables and relations.
H2 database files are located at activitytimeline/bin/atdb folder.
Also, please make sure all migrated table names are in lowercase letters e.g. "person", not "PERSON". All table names in UPPERCASE letters should be renamed to lowercase letters.
Oracle database
- Case: ActivityTimeline is configured to use H2 database by default. A customer would like to migrate it to their Oracle database engine.
- Q: Could you send directions for doing this?
# Oracle Database connection URL
# Structure: dataSource.url=jdbc:oracle:thin:@//<ORACLE_DB_HOST>:<ORACLE_DB_PORT>/<SERVICE_NAME_FOR_ACTIVITYTIMELINE>
#dataSource.url=jdbc:oracle:thin:@//localhost:1521/timeline
# Oracle Database username
#dataSource.username=at_user
# Oracle Database password
#dataSource.password=at_password
# Other properties
#dataSource.pooled=true
#dataSource.driverClassName=oracle.jdbc.driver.OracleDriver
#dataSource.dialect=com.timeline.hibernate.ActivityTimelineOracleDialect
#dataSource.dbCreate=update
#dataSource.properties.validationQuery=SELECT 1 FROM DUAL
If you would like to migrate existing data from H2 database to Oracle DB, then you would need to use an external tools to migrate the database data like Oracle SQL Developer, SQuirreL SQL with SQuirreL DB Copy Plugin (first you need to install SQuirreL SQL and on top of that the SQuirreL DB Copy Plugin). Also, you may need to start ActivityTimeline on an empty external database (schema) first for ActivityTimeline to create all required tables and relations.
It is required to enable "Extended Data Types" in Oracle DB for VARCHAR2 type to support up to 32767 bytes: https://docs.oracle.com/en/database/oracle/oracle-database/18/spuss/enabling-the-new-extended-data-type-capability.html
Important Note for Oracle DB v12.2.0 and above switch: it is required to rename several entities before the migration for Oracle DB correct work:
- "level" table should be renamed to "knowledge_level",
- "password" column of "person" table must be renamed to lowercase letters
- "date" column of "worklog_record" table should be renamed to "worklog_date"
- and "comment" column of "worklog_record" table should be renamed to "worklog_comment"
Important Note for Oracle DB v12.1.0 switch: it is required to rename several additional entities before the migration for Oracle DB correct work:
- "level" table should be renamed to "knowledge_level",
- "password" column of "person" table must be renamed to lowercase letters
- "date" column of "worklog_record" table should be renamed to "worklog_date"
- "comment" column of "worklog_record" table should be renamed to "worklog_comment"
- "parent_issue_remaining_time_estimate" column of "issue" table should be renamed to "parent_remain_time_estimate"
- "anticipated_start_date_field_name" column of "integration_config" table should be renamed to "start_date_field"
- "anticipated_end_date_field_name" column of "integration_config" table should be renamed to "end_date_field"
- "issue_part_assignee_field_name" column of "integration_config" table should be renamed to "issue_part_assignee_field"
- "connect_access_token_created_date" column of "integration_config" table should be renamed to "connect_token_created_date"
- "issue_id_for_getting_list_of_assignees" column of "integration_config" table should be renamed to "issue_id_for_users"
- Additional setting should be added to configuration.properties file:
dataSource.oracleLegacyMode=1
H2 database files are located at activitytimeline/bin/atdb folder.