You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To improve startup robustness and cross-platform compatibility, especially on Windows, the OpenMRS Standalone project uses a custom wrapper around the `DB` class from MariaDB4j called `ReusableDB`.
264
+
To improve startup robustness and cross-platform compatibility, especially on Windows, the OpenMRS Standalone project utilizes the native folder-reuse capabilities of **MariaDB4j 3.3.1**. This replaces the legacy custom `ReusableDB` wrapper.
265
265
266
266
#### 🔍 Purpose
267
-
268
-
`ReusableDB` avoids deleting the `dataDir` when the database is already initialized. This:
269
-
- Prevents startup failures due to locked files on Windows.
270
-
- Supports seamless restarts of the Standalone without losing data.
271
-
- Makes switching between demo and empty databases more reliable.
267
+
By leveraging modern MariaDB4j internal logic, the Standalone ensures:
268
+
-**Data Persistence:** Existing data in the `dataDir` is automatically detected and preserved.
269
+
-**Windows Robustness:** Avoids common file-locking issues on Windows by checking for existing data before attempting a fresh installation.
270
+
-**Simplified Maintenance:** Leverages standard library calls instead of custom internal workarounds.
272
271
273
272
#### ✅ How it Works
274
-
- Checks for the presence of the `openmrs` database directory inside `dataDir`.
275
-
- If not found, triggers the initial MariaDB install process.
276
-
- Otherwise, starts MariaDB using the existing configuration and data files.
273
+
The `MariaDbController` now utilizes the improved `newEmbeddedDB` factory method:
274
+
1.**Internal Check:** The library internally checks if the database directory already exists and contains data.
275
+
2.**Smart Initialization:** * If the folder is **empty**, it proceeds with a fresh installation and schema setup.
276
+
* If data is **present**, it skips the installation phase and safely opens the existing database.
0 commit comments