Jdbc Data Source
class JdbcDataSource(jdbc: DataSource, initSql: String? = null, statementCacheSize: Int = 64) : DataSource
JDBC DataSource wrapper that implements KDBC DataSource interface.
initSql is a single SQL statement executed on every freshly opened connection before it is returned to the caller — equivalent to HikariCP's connectionInitSql. If the statement fails the connection is closed and the exception propagates.
Usage:
val hikariDS = HikariDataSource(config)
val stormify = Stormify(hikariDS) // Uses convenience function
// or
val stormify = Stormify(JdbcDataSource(hikariDS, initSql = "PRAGMA foreign_keys = ON"))Content copied to clipboard