Connection
interfacein packageklyn.databases.sql
public interface Connection extends AutoClosable:
└ Connection

SQL connection contract.

Connection state is exposed through properties. Execution objects are created with statement(), prepared(...), and callable(...).

import klyn.databases.sql

connection as Connection = DriverManager.connect("postgresql://db/app")
connection.autoCommit = false
Properties
Modifier and Type Member Description
public property autoCommit
autoCommit as Boolean
True when each statement is committed immediately.
public property catalog
catalog as String
Current catalog when supported by the driver.
public readonly property clientInfo
clientInfo as Map<String, String>
Mutable client-info map.
public readonly property closed
closed as Boolean
True when the connection has been closed.
public readonly property connected
connected as Boolean
True when the connection has been opened.
public property holdability
holdability as ResultSetHoldability
Current result-set holdability.
public readonly property metadata
metadata as DatabaseMetaData
Database metadata facade.
public property networkTimeoutMillis
networkTimeoutMillis as Int
Network timeout in milliseconds.
public property readOnly
readOnly as Boolean
True when the connection is read-only.
public property schema
schema as String
Current schema when supported by the driver.
public readonly property sslContext
sslContext as SSLContext
Optional TLS context used by the underlying secure transport.
public property transactionIsolation
transactionIsolation as TransactionIsolation
Current transaction isolation level.
public readonly property url
url as String
Effective connection URL.
public readonly property userName
userName as String
Effective user name.
public readonly property warning
warning as SQLWarning
Current warning chain.
Methods
Modifier and Type Member Description
public callable
callable(sql as String, resultSetType as ResultSetType = ResultSetType.FORWARD_ONLY, concurrency as ResultSetConcurrency = ResultSetConcurrency.READ_ONLY, holdability as ResultSetHoldability = ResultSetHoldability.CLOSE_CURSORS_AT_COMMIT) as CallableStatement throws SQLException
Prepares one stored-procedure call.
public clearWarnings
clearWarnings() as Void
Clears the warning chain.
public commit
commit() as Void throws SQLException
Commits the current transaction.
public createStatement
createStatement(resultSetType as ResultSetType = ResultSetType.FORWARD_ONLY, concurrency as ResultSetConcurrency = ResultSetConcurrency.READ_ONLY, holdability as ResultSetHoldability = ResultSetHoldability.CLOSE_CURSORS_AT_COMMIT) as Statement throws SQLException
Compatibility alias of `statement(.
public isValid
isValid(timeoutSeconds as Int = 0) as Boolean
Returns true when the connection is still usable.
public nativeSql
nativeSql(sql as String) as String
Converts generic SQL to the driver-native dialect.
public prepareCall
prepareCall(sql as String, resultSetType as ResultSetType = ResultSetType.FORWARD_ONLY, concurrency as ResultSetConcurrency = ResultSetConcurrency.READ_ONLY, holdability as ResultSetHoldability = ResultSetHoldability.CLOSE_CURSORS_AT_COMMIT) as CallableStatement throws SQLException
Compatibility alias of `callable(.
public prepareStatement
prepareStatement(sql as String, resultSetType as ResultSetType = ResultSetType.FORWARD_ONLY, concurrency as ResultSetConcurrency = ResultSetConcurrency.READ_ONLY, holdability as ResultSetHoldability = ResultSetHoldability.CLOSE_CURSORS_AT_COMMIT) as PreparedStatement throws SQLException
Compatibility alias of `prepared(.
public prepared
prepared(sql as String, resultSetType as ResultSetType = ResultSetType.FORWARD_ONLY, concurrency as ResultSetConcurrency = ResultSetConcurrency.READ_ONLY, holdability as ResultSetHoldability = ResultSetHoldability.CLOSE_CURSORS_AT_COMMIT) as PreparedStatement throws SQLException
Prepares one SQL statement.
public releaseSavepoint
releaseSavepoint(savepoint as Savepoint) as Void throws SQLException
Releases one savepoint.
public rollback
rollback(savepoint as Savepoint = null) as Void throws SQLException
Rolls back the current transaction or one savepoint.
public savepoint
savepoint(name as String = "") as Savepoint throws SQLException
Creates a savepoint descriptor.
public statement
statement(resultSetType as ResultSetType = ResultSetType.FORWARD_ONLY, concurrency as ResultSetConcurrency = ResultSetConcurrency.READ_ONLY, holdability as ResultSetHoldability = ResultSetHoldability.CLOSE_CURSORS_AT_COMMIT) as Statement throws SQLException
Creates a statement with optional cursor settings.
Methods inherited from AutoClosable: close