diff --git a/README.md b/README.md index b28a81c..e4e1ac9 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,7 @@ NOTE: Without this folder structure, you will get errors while trying to run the ## DATABASE CONNECTION STRING - jdbc:mysql://127.0.0.1:3316/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 + jdbc:mariadb://127.0.0.1:3316/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 The above default database connection string has all in the openmrs mysql default database connection and is used for the MariaDB connection. diff --git a/packagezip.sh b/packagezip.sh index 626ccb3..74679de 100644 --- a/packagezip.sh +++ b/packagezip.sh @@ -28,7 +28,7 @@ cp ../target/openmrs.war tomcat/webapps/openmrs.war echo "application_data_directory=appdata" >> openmrs-runtime.properties echo "reset_connection_password=true" >> openmrs-runtime.properties echo "tomcatport=8081" >> openmrs-runtime.properties -echo "connection.url=jdbc:mysql://localhost:3316/openmrs?" >> openmrs-runtime.properties +echo "connection.url=jdbc:mariadb://localhost:3316/openmrs?" >> openmrs-runtime.properties echo "connection.username=openmrs" >> openmrs-runtime.properties echo "connection.password=Admin123" >> openmrs-runtime.properties diff --git a/pom-step-01.xml b/pom-step-01.xml index c43689e..093bb4b 100644 --- a/pom-step-01.xml +++ b/pom-step-01.xml @@ -84,9 +84,9 @@ empty-db-create-schema generate-resources - com.mysql.cj.jdbc.Driver + org.mariadb.jdbc.Driver liquibase-schema-only.xml - + openmrs test true @@ -110,9 +110,9 @@ empty-db-add-core-data generate-resources - com.mysql.cj.jdbc.Driver + org.mariadb.jdbc.Driver liquibase-core-data.xml - openmrs + openmrs test true false diff --git a/pom-step-02.xml b/pom-step-02.xml index 3b20755..af4e3e3 100644 --- a/pom-step-02.xml +++ b/pom-step-02.xml @@ -106,7 +106,7 @@ runtime ${project.build.directory}/ciel-sql/openmrs_concepts_${ciel.dictionary.openmrs.version}_${ciel.dictionary.version}.sql - + openmrs test @@ -122,10 +122,10 @@ empty-db-add-ciel-data generate-resources - com.mysql.cj.jdbc.Driver + org.mariadb.jdbc.Driver ${project.build.directory}/liquibase liquibase-ciel-data.xml - + openmrs test true diff --git a/pom-step-03.xml b/pom-step-03.xml index f8f57d8..8f36388 100644 --- a/pom-step-03.xml +++ b/pom-step-03.xml @@ -43,9 +43,9 @@ empty-db-update-to-latest generate-resources - com.mysql.cj.jdbc.Driver + org.mariadb.jdbc.Driver liquibase-update-to-latest.xml - + openmrs test true diff --git a/pom-step-04.xml b/pom-step-04.xml index 3ea398a..9094a8c 100644 --- a/pom-step-04.xml +++ b/pom-step-04.xml @@ -86,7 +86,7 @@ runtime ${project.basedir}/large-demo-data-2-7-0.sql - jdbc:mysql://localhost:33328/openmrs + jdbc:mariadb://localhost:33328/openmrs openmrs test diff --git a/pom-step-05.xml b/pom-step-05.xml index 16638b7..936695a 100644 --- a/pom-step-05.xml +++ b/pom-step-05.xml @@ -43,9 +43,9 @@ demo-db-update-to-latest generate-resources - com.mysql.cj.jdbc.Driver + org.mariadb.jdbc.Driver liquibase-update-to-latest.xml - + openmrs test true diff --git a/pom.xml b/pom.xml index 99afeaf..0a7364d 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ large-demo-data-2-7-0.sql.zip liquibase-ciel-data.xml - 2.8.0-alpha + 2.8.1-SNAPSHOT UTF-8 9.0.106 5.12.2 @@ -60,9 +60,9 @@ compile - mysql - mysql-connector-java - 8.0.30 + org.mariadb.jdbc + mariadb-java-client + 3.5.4 compile diff --git a/readme.txt b/readme.txt index eeb9c7b..db0fa7e 100644 --- a/readme.txt +++ b/readme.txt @@ -140,7 +140,7 @@ splashscreen-loading.png This is the splash screen displayed on startup. It c ............... DATABASE CONNECTION STRING....................... -jdbc:mysql://127.0.0.1:3316/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 +jdbc:mariadb://127.0.0.1:3316/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 The above default database connection string has all in the openmrs mysql default database connection string used for a MariaDB connection diff --git a/src/main/config/openmrs-runtime.properties b/src/main/config/openmrs-runtime.properties index 24bab9b..ea362cc 100644 --- a/src/main/config/openmrs-runtime.properties +++ b/src/main/config/openmrs-runtime.properties @@ -3,7 +3,7 @@ module.allow_web_admin=true # this connection url is copied several times in pom.xml, with the directory changed from database to emptydatabase and 3316 changed to 3326. # If you change the property here, make sure to change it there too. -connection.url=jdbc:mysql://127.0.0.1:3316/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull +connection.url=jdbc:mariadb://127.0.0.1:3316/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull connection.username=openmrs auto_update_database=false connection.password=test diff --git a/src/main/java/org/openmrs/standalone/DbInitializer.java b/src/main/java/org/openmrs/standalone/DbInitializer.java index 4ea28da..b7ce03d 100644 --- a/src/main/java/org/openmrs/standalone/DbInitializer.java +++ b/src/main/java/org/openmrs/standalone/DbInitializer.java @@ -20,7 +20,7 @@ public class DbInitializer { // This is to be called via pom-step-04 with id 'import-demo-sql' public static void main(String[] args) throws Exception { - Class.forName("com.mysql.cj.jdbc.Driver").newInstance(); + Class.forName("org.mariadb.jdbc.Driver").newInstance(); String sqlFilePath = args[0]; String jdbcUrl = args[1]; diff --git a/src/main/java/org/openmrs/standalone/MariaDbController.java b/src/main/java/org/openmrs/standalone/MariaDbController.java index b87acf4..c387237 100644 --- a/src/main/java/org/openmrs/standalone/MariaDbController.java +++ b/src/main/java/org/openmrs/standalone/MariaDbController.java @@ -78,7 +78,7 @@ public static void startMariaDB(int port, String userPassword) throws Exception mariaDB = ReusableDB.openEmbeddedDB(mariaDBConfig.build()); mariaDB.start(); - Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:" + port + "/", ROOT_USER, ROOT_PASSWORD); + Connection conn = DriverManager.getConnection("jdbc:mariadb://localhost:" + port + "/", ROOT_USER, ROOT_PASSWORD); try (Statement stmt = conn.createStatement()) { stmt.execute("ALTER USER 'root'@'localhost' IDENTIFIED BY '" + ROOT_PASSWORD + "';"); stmt.execute("GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;"); @@ -98,7 +98,7 @@ public static void startMariaDB(int port, String userPassword) throws Exception mariaDB.createDB(DATABASE_NAME, ROOT_USER, ROOT_PASSWORD); // ✅ Create openmrs user and grant permissions - try (Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:" + port + "/", ROOT_USER, ROOT_PASSWORD)) { + try (Connection connection = DriverManager.getConnection("jdbc:mariadb://localhost:" + port + "/", ROOT_USER, ROOT_PASSWORD)) { try (Statement stmt = connection.createStatement()) { // Create user if not exists String createUserSQL = "CREATE USER IF NOT EXISTS 'openmrs'@'localhost' IDENTIFIED BY '" + userPassword + "';"; diff --git a/src/main/java/org/openmrs/standalone/StandaloneUtil.java b/src/main/java/org/openmrs/standalone/StandaloneUtil.java index 5083aff..3ccdf7f 100644 --- a/src/main/java/org/openmrs/standalone/StandaloneUtil.java +++ b/src/main/java/org/openmrs/standalone/StandaloneUtil.java @@ -147,7 +147,7 @@ public static String setPortsAndMySqlPassword(String mariaDBPort, String tomcatP String portToken = ":" + mariaDBPort + "/"; - //in a string like this: jdbc:mysql://localhost:3316/openmrs?autoReconnect=true + //in a string like this: jdbc:mariadb://localhost:3316/openmrs?autoReconnect=true //look for something like this :3316/ String regex = ":[0-9]+/"; Pattern pattern = Pattern.compile(regex); @@ -316,7 +316,7 @@ public static String getContextName() { private static boolean setMysqlPassword(String url, String mysqlPort, String username, String newPassword) throws Exception { try { - Class.forName("com.mysql.cj.jdbc.Driver").newInstance(); + Class.forName("org.mariadb.jdbc.Driver").newInstance(); MariaDbController.startMariaDB(mysqlPort, properties.getProperty("connection.password", "")); @@ -418,7 +418,7 @@ private static void updateRuntimeProperties(Map newProps) { */ public static void startupDatabaseToCreateDefaultUser(String mariaDBPort) throws Exception { try { - Class.forName("com.mysql.cj.jdbc.Driver"); + Class.forName("org.mariadb.jdbc.Driver"); } catch (ClassNotFoundException ex) { throw new RuntimeException("Cannot find MySQL driver class", ex); } @@ -482,7 +482,7 @@ public static String setRuntimePropertiesFileMysqlAndTomcatPorts(String mariaDBP String connectionString = properties.getProperty(KEY_CONNECTION_URL); String portToken = ":" + mariaDBPort + "/"; - //in a string like this: jdbc:mysql://localhost:3316/openmrs?autoReconnect=true + //in a string like this: jdbc:mariadb://localhost:3316/openmrs?autoReconnect=true //look for something like this :3316/ String regex = ":[0-9]+/"; Pattern pattern = Pattern.compile(regex); diff --git a/src/test/java/org/openmrs/standalone/MariaDbControllerTest.java b/src/test/java/org/openmrs/standalone/MariaDbControllerTest.java index 58e4c3b..2df88ab 100644 --- a/src/test/java/org/openmrs/standalone/MariaDbControllerTest.java +++ b/src/test/java/org/openmrs/standalone/MariaDbControllerTest.java @@ -26,7 +26,7 @@ public class MariaDbControllerTest { private static final int MARIADB_PORT = 33126; - private static final String JDBC_URL = "jdbc:mysql://127.0.0.1:" + MARIADB_PORT + "/" + MariaDbController.DATABASE_NAME; + private static final String JDBC_URL = "jdbc:mariadb://127.0.0.1:" + MARIADB_PORT + "/" + MariaDbController.DATABASE_NAME; private static final String ROOT_USER = "root"; private static final String ROOT_PASSWORD = ""; diff --git a/src/test/java/org/openmrs/standalone/StandaloneUtilTest.java b/src/test/java/org/openmrs/standalone/StandaloneUtilTest.java index 853be41..3ebee78 100644 --- a/src/test/java/org/openmrs/standalone/StandaloneUtilTest.java +++ b/src/test/java/org/openmrs/standalone/StandaloneUtilTest.java @@ -37,7 +37,7 @@ class StandaloneUtilTest { private static final String USERNAME = "openmrs"; private static final String MARIADB_PORT = "33126"; - private static final String DEFAULT_URL = "jdbc:mysql://127.0.0.1:" + MARIADB_PORT + "/" + MariaDbController.DATABASE_NAME; + private static final String DEFAULT_URL = "jdbc:mariadb://127.0.0.1:" + MARIADB_PORT + "/" + MariaDbController.DATABASE_NAME; private static final String MARIADB_BASEDIR_NAME = "mariadb-base-dir"; private static final String DATA_DIR_NAME = "data";