
Database Utils
A simple mod for developers to make database usage easier
About this Mod
Database Utils
🔎 Explanations
This mod includes some utilities for working with databases.
The most popular connectors are included directly in the mod JAR, which avoids having to import them into each mod and helps reduce the overall size of your projects.
To import this library, you must add the following to your build.gradle file.
repositories {
maven { url "https://api.modrinth.com/maven" }
}
dependencies {
implementation "maven.modrinth:database-utils:1.0.0"
}
🖥️ Usage
First, you need to define your own class MyCustomDB, which extends DatabaseQueries.
This class is intended to contain all SQL related methods.
In this context, you have access to some method from DatabaseQueries, such as getType, which help you create an implementation compatible with multiple databases.
public class MyCustomDB extends DatabaseQueries {
@Override
public void init() {
try (Connection connection = getConnection()) {
/* ... */
} catch (SQLException | DatabaseLinkException e) {
LOGGER.error("Unable to initialize: {}", e.getMessage());
}
}
/* other methods */
}
You will also need to create a database instance. Here is a little code snippet that creates a database based on a string value. This value can be obtained, for example, from a configuration file.
String name = /* ... */;
Type type = DatabaseUtils.getType(name);
Database db;
switch (type) {
case MYSQL -> db = new MySQL(/* ... */);
case MARIADB -> db = new MariaDB(/* ... */);
case POSTGRESQL -> db = new PostgreSQL(/* ... */);
case SQLITE -> db = new SQLite(/* ... */);
case TEST -> db = new TestDB(/* ... */);
}
Currently, this mod supports four databases:
- MySQL (
mysql) - MariaDB (
mariadb) - PostgreSQL (
postgres) - SQLite (
sqlite)
A test database is also provided if you want to do some tests using stub values.
Once your database has been initialized, you need to link it to your MyCustomDB implementation.
MyCustomDB custom = new MyCustomDB();
custom.link(db);
// You can now use methods that contain SQL
custom.init();
/* ... */
Available Versions
How to Install Database Utils on Your Server
Order Server
Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).
Set fabric Loader
In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.11).
Install Mod
Open the mod browser in the dashboard and search for "Database Utils". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.
Compatibility
Mod Loaders
Minecraft Versions
1.21.11, 1.21.10, 1.21.9 (+16 more)
Server-side
~ OptionalRecommended RAM
4 GB(min. 3 GB)Frequently Asked Questions
Database Utils server crashes on startup – what to do?
Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.11). You can switch loaders with one click in the panel.
Is Database Utils compatible with fabric?
Database Utils officially supports fabric for Minecraft 1.21.11, 1.21.10, 1.21.9. The Mado dashboard automatically detects incompatible loader combinations.
Server lagging with Database Utils – how to optimize performance?
Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Database Utils consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.
Similar Mods
Rent Modded Server
Install Database Utils with just one click on your server.