Database Utils

Database Utils

A simple mod for developers to make database usage easier

by
102 Downloads
fabriclibrarystorage
Rent Server with this Mod

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

Database Utils 1.0.0release
MC 1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11fabric
November 29, 2025

How to Install Database Utils on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.11).

3

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

fabric

Minecraft Versions

1.21.11, 1.21.10, 1.21.9 (+16 more)

Server-side

~ Optional

Recommended 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.

Rent Modded Server

Install Database Utils with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
MIT License
Server-side
Optional

Supported Versions

1.21.111.21.101.21.91.21.81.21.71.21.61.21.51.21.41.21.31.21.2+9 more