DbConnectionConfig
Represents the configuration for an internally managed JDBC database connection.
This class defines connection parameters used by the library to create a Connection when the user does not provide one explicitly. It is designed for safe, read-only access by default.
NOTE: Connections created using this configuration are managed entirely by the library. Users do not have access to the underlying Connection instance and cannot commit or close it manually.
Read-Only Mode Behavior:
When readOnly is true (default), the connection operates in read-only mode with:
Connection.setReadOnly(true)Connection.setAutoCommit(false)automatic
rollback()at the end of execution
When readOnly is false, the connection uses JDBC defaults (usually read-write), but the library still rejects any queries that appear to modify data (e.g. contain INSERT, UPDATE, DELETE, etc.).
Examples:
// Safe read-only connection (default)
val config = DbConnectionConfig("jdbc:sqlite::memory:")
val df = DataFrame.readSqlQuery(config, "SELECT * FROM books")
// Use default JDBC connection settings (still protected against mutations)
val config = DbConnectionConfig(
url = "jdbc:sqlite::memory:",
readOnly = false
)Functions
Converts the result of an SQL query or SQL table (by name) to the DataFrame.
Retrieves the schema of an SQL query result or the SQL table using the provided database configuration.