MySQL
Dependencies
build.gradle.kts
dependencies {
implementation("io.koalaql:koala-mysql: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 = MysqlDataSource(
provider = { DriverManager.getConnection(jdbcUrl) }
)
JDBC
Read more here
to learn more about JDBC for MySQL and see example values for jdbcUrl
.