DriverManager
classin packageklyn.databases.sql
public class DriverManager
DriverManager

SQL connection factory.

This class centralizes connection options, maintains the SQL driver registry, and delegates connection creation to the first driver supporting a URL.

import klyn.databases.sql

cnx = DriverManager.getConnection("mariadb://localhost:3306/app", "app", "secret")
Fields
Modifier and Type Member Description
public static defaultProperties
defaultProperties as SortedMap<String, String> = SortedMap<String, String>()
Global arbitrary connection properties.
public static loginTimeoutSeconds
loginTimeoutSeconds as Int = 0
Login timeout applied by driver resolution.
Properties
Modifier and Type Member Description
public static readonly property drivers
drivers as List<Driver>
Registered SQL drivers, in resolution order.
Methods
Modifier and Type Member Description
public static connect
connect(url as String, properties as Map<String, String> = null) as Connection throws Exception
Opens a connection from a URL and optional properties.
public static driverFor
driverFor(url as String) as Driver throws SQLFeatureNotSupportedException
Returns the first registered driver supporting the URL.
public static getConnection
getConnection(url as String, user as String = "", password as String = "") as Connection throws Exception
Opens a SQL connection from a database URL and credentials.
public static register
register(driver as Driver) as Void throws SQLFeatureNotSupportedException
Registers a custom SQL driver at the end of the resolution list.