Skip to content

Database Utils

A simple mod for developers to make database usage easier

Fabric
Loaders
Fabric
Downloads on Modrinth
252
Followers on Modrinth
2
versions
2
Updated
July 14, 2026Jul 14
Published
in 2025
This is a library — other mods need it, and it adds nothing to the game by itselfRequired by 1 mods. Download it if another mod needs it.

At a glance

A library: other mods need it — required by 1 mods
Runs on Fabric
For Minecraft 1.20–26.2
Works on either side — install it in the game, on the server, or both
Latest version — 1.0.0+26.1 from July 14, 2026
License MIT — free
Where it's needed
In gameoptionalOn serveroptional

Works both in the game and on the server — install where you need it

Game versions1.20–26.2

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

Configuration is managed by this library. By using the following line, a .properties file is automatically created (if it does not already exist) and loaded from the config folder.

Config config = new Config(MOD_ID);

In this example, the file will be named MOD_ID.properties.
Here is an example configuration file.

storage=postgres
host=127.0.0.1
port=5432
database=minecraft_db
user=user
password=password
KeyDescription
storageDatabase type. Must be one of: postgres, mysql, mariadb, sqlite, or test.
hostIP address or hostname of the database server
portPort used by the database server.
databaseName of the database.
userUser used to connect to the database.
passwordPassword of the user.

Then, 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 {

    public MyCustomDB(Database db) {
        super(db);
    }
    
    @Override
    public void init() {
        try (Connection connection = getConnection()) {
            /* ... */
        } catch (SQLException | DatabaseLinkException e) {
            LOGGER.error("Unable to initialize: {}", e.getMessage());
        }
    }
    
    /* other methods */
    
    public void someMethod() {
        /* ... */
    }
}

You will also need to create a database instance. This is where the Config object is used. The following code snippet retrieves the database defined in the configuration and initializes your DatabaseQueries implementation.

Database database = DatabaseUtils.getDatabase(config);
MyCustomDB custom = new MyCustomDB(database);

You can now call any query defined in your DatabaseQueries implementation through your custom instance.

custom.someMethod();

FAQ

How to install Database Utils?

Install Fabric for your Minecraft version, download Database Utils for the same version and loader, put the file into the mods folder and launch the game with the loader profile.

Which Minecraft versions does Database Utils support?

Database Utils has builds for Minecraft 1.20–26.2.

Is Database Utils needed on the server?

Works on either side — install it in the game, on the server, or both

License and source
MIT Licensefree to use and share with credit to the author
Original — Modrinth↗Files unchanged, verified with SHA-512Is this your mod? For rights holders

The site uses cookies: the necessary ones for sign-in and the theme, plus the Yandex Metrica and LiveInternet visit counters — they show us how the site is used. We have no advertising cookies. More