Skip to main content

H2

Dependencies

build.gradle.kts
dependencies {
implementation("io.koalaql:koala-h2:0.0.11")
}

Instantiating the database

Koala models your database as a DataSource. You should obtain one once at the start of your program. The only required argument is the provider which supplies JDBC connections. JDBC connections can be supplied directly from the driver or from a connection pool like HikariCP

val ds = H2DataSource(
provider = { DriverManager.getConnection(jdbcUrl) }
)
JDBC

Read more here to learn more about JDBC for H2 and see example values for jdbcUrl.