query4k

A simple Kotlin library to interact with your relational databases.

Motivation

At the time of writing this library, it felt to me like Kotlin really lacked good libraries for interacting with your SQL database. I tried most of the common ORMs (Exposed, JPA, Ktorm), but ORMs come with their own drawbacks, and I didn't feel like any of these libraries offered any features that were good enough to compensate for the disadvantages that are inherent in ORMs. I also found all of them to be quite frustrating to work with.

I prefer writing my queries manually rather than using an ORM. While there is a library on the JVM, jOOQ, that does this, I found it quite complex to set up. I wanted something that is both simple and offers control. JDBC exists, but it is too low-level. And so, query4k was created, building on top of JDBC.

Recently I discovered the lite-for-jdbc library, which is quite similar to query4k. I would probably recommend it over query4k in most projects, as it is more mature and has better feature support. The advantage query4k does have over lite-for-jdbc is how query4k leverages Kotlinx serialization to remove a little boilerplate code.

The project

You can read more about this project on its GitHub repository.