Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
2 changes: 1 addition & 1 deletion packagezip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions pom-step-01.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
<id>empty-db-create-schema</id>
<phase>generate-resources</phase>
<configuration>
<driver>com.mysql.cj.jdbc.Driver</driver>
<driver>org.mariadb.jdbc.Driver</driver>
<changeLogFile>liquibase-schema-only.xml</changeLogFile>
<url><![CDATA[jdbc:mysql://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<url><![CDATA[jdbc:mariadb://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<username>openmrs</username>
<password>test</password>
<verbose>true</verbose>
Expand All @@ -110,9 +110,9 @@
<id>empty-db-add-core-data</id>
<phase>generate-resources</phase>
<configuration>
<driver>com.mysql.cj.jdbc.Driver</driver>
<driver>org.mariadb.jdbc.Driver</driver>
<changeLogFile>liquibase-core-data.xml</changeLogFile>
<url><![CDATA[jdbc:mysql://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url> <username>openmrs</username>
<url><![CDATA[jdbc:mariadb://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url> <username>openmrs</username>
<password>test</password>
<verbose>true</verbose>
<dropFirst>false</dropFirst>
Expand Down
6 changes: 3 additions & 3 deletions pom-step-02.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<classpathScope>runtime</classpathScope>
<arguments>
<argument>${project.build.directory}/ciel-sql/openmrs_concepts_${ciel.dictionary.openmrs.version}_${ciel.dictionary.version}.sql</argument>
<argument><![CDATA[jdbc:mysql://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></argument>
<argument><![CDATA[jdbc:mariadb://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></argument>
<argument>openmrs</argument>
<argument>test</argument>
</arguments>
Expand All @@ -122,10 +122,10 @@
<id>empty-db-add-ciel-data</id>
<phase>generate-resources</phase>
<configuration>
<driver>com.mysql.cj.jdbc.Driver</driver>
<driver>org.mariadb.jdbc.Driver</driver>
<searchPath>${project.build.directory}/liquibase</searchPath>
<changeLogFile>liquibase-ciel-data.xml</changeLogFile>
<url><![CDATA[jdbc:mysql://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<url><![CDATA[jdbc:mariadb://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<username>openmrs</username>
<password>test</password>
<verbose>true</verbose>
Expand Down
4 changes: 2 additions & 2 deletions pom-step-03.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<id>empty-db-update-to-latest</id>
<phase>generate-resources</phase>
<configuration>
<driver>com.mysql.cj.jdbc.Driver</driver>
<driver>org.mariadb.jdbc.Driver</driver>
<changeLogFile>liquibase-update-to-latest.xml</changeLogFile>
<url><![CDATA[jdbc:mysql://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<url><![CDATA[jdbc:mariadb://127.0.0.1:33326/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<username>openmrs</username>
<password>test</password>
<verbose>true</verbose>
Expand Down
2 changes: 1 addition & 1 deletion pom-step-04.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<classpathScope>runtime</classpathScope>
<arguments>
<argument>${project.basedir}/large-demo-data-2-7-0.sql</argument>
<argument>jdbc:mysql://localhost:33328/openmrs</argument>
<argument>jdbc:mariadb://localhost:33328/openmrs</argument>
<argument>openmrs</argument>
<argument>test</argument>
</arguments>
Expand Down
4 changes: 2 additions & 2 deletions pom-step-05.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<id>demo-db-update-to-latest</id>
<phase>generate-resources</phase>
<configuration>
<driver>com.mysql.cj.jdbc.Driver</driver>
<driver>org.mariadb.jdbc.Driver</driver>
<changeLogFile>liquibase-update-to-latest.xml</changeLogFile>
<url><![CDATA[jdbc:mysql://127.0.0.1:33328/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<url><![CDATA[jdbc:mariadb://127.0.0.1:33328/openmrs?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8]]></url>
<username>openmrs</username>
<password>test</password>
<verbose>true</verbose>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<liquibase.demodata.archive>large-demo-data-2-7-0.sql.zip</liquibase.demodata.archive>
<liquibase.cieldata.filename>liquibase-ciel-data.xml</liquibase.cieldata.filename>

<openmrs.version>2.8.0-alpha</openmrs.version>
<openmrs.version>2.8.1-SNAPSHOT</openmrs.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tomcat.version>9.0.106</tomcat.version>
<junitVersion>5.12.2</junitVersion>
Expand Down Expand Up @@ -60,9 +60,9 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.30</version>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.5.4</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/config/openmrs-runtime.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/openmrs/standalone/DbInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/openmrs/standalone/MariaDbController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;");
Expand All @@ -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 + "';";
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/openmrs/standalone/StandaloneUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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", ""));

Expand Down Expand Up @@ -418,7 +418,7 @@ private static void updateRuntimeProperties(Map<String, String> 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);
}
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Loading