← Back to Stormify Documentation

KdbcDataSource

actual fun KdbcDataSource(url: String, user: String?, password: String?): DataSource

Android actual for KdbcDataSource. Not yet implemented.

On Android, use AndroidDataSource directly to wrap an android.database.sqlite.SQLiteDatabase. Network databases are out of scope for Android native builds.

expect fun KdbcDataSource(url: String, user: String? = null, password: String? = null): DataSource

Platform-agnostic DataSource factory.

Takes a standard JDBC URL (jdbc:postgresql://..., jdbc:sqlite:..., etc.) and returns a DataSource that works on every supported platform:

  • Native (Linux x64): backed by the unified kdbc C library (libkdbc.a). Parses the JDBC URL via JdbcUrlParser and dispatches to the appropriate C driver (SQLite, PostgreSQL, MariaDB/MySQL, Oracle, MSSQL).

  • JVM / Android: not yet implemented — throws SQLException with a hint pointing to JdbcDataSource / AndroidDataSource which wrap an existing platform DataSource.

Explicit user / password arguments override any credentials embedded in the URL (mirrors java.sql.DriverManager.getConnection(url, user, password) behaviour).

Unknown URL parameters (e.g. ssl=true, connectTimeout=10) that the underlying C driver does not recognize are emitted as warnings via the logger, not silently ignored.

Example:

val ds = KdbcDataSource("jdbc:postgresql://localhost:5432/mydb", "user", "pass")
val stormify = Stormify(ds)
actual fun KdbcDataSource(url: String, user: String?, password: String?): DataSource

JVM actual for KdbcDataSource. Not yet implemented.

On JVM, use JdbcDataSource directly to wrap a javax.sql.DataSource (e.g. HikariCP). A future implementation may parse the JDBC URL and call DriverManager.getConnection(url, user, password) to provide true write-once multiplatform code — tracked as TODO.

actual fun KdbcDataSource(url: String, user: String?, password: String?): DataSource

Platform-agnostic DataSource factory.

Takes a standard JDBC URL (jdbc:postgresql://..., jdbc:sqlite:..., etc.) and returns a DataSource that works on every supported platform:

  • Native (Linux x64): backed by the unified kdbc C library (libkdbc.a). Parses the JDBC URL via JdbcUrlParser and dispatches to the appropriate C driver (SQLite, PostgreSQL, MariaDB/MySQL, Oracle, MSSQL).

  • JVM / Android: not yet implemented — throws SQLException with a hint pointing to JdbcDataSource / AndroidDataSource which wrap an existing platform DataSource.

Explicit user / password arguments override any credentials embedded in the URL (mirrors java.sql.DriverManager.getConnection(url, user, password) behaviour).

Unknown URL parameters (e.g. ssl=true, connectTimeout=10) that the underlying C driver does not recognize are emitted as warnings via the logger, not silently ignored.

Example:

val ds = KdbcDataSource("jdbc:postgresql://localhost:5432/mydb", "user", "pass")
val stormify = Stormify(ds)