connectWithSpringSupportGlobally

fun Database.Companion.connectWithSpringSupportGlobally(dataSource: DataSource, dialect: SqlDialect = detectDialectImplementation(), logger: Logger = detectLoggerImplementation(), alwaysQuoteIdentifiers: Boolean = false, generateSqlInUpperCase: Boolean? = null): Database(source)

Deprecated

ktorm-global will be removed in the future, please migrate to the standard API.

Connect to a database using a DataSource with the Spring support enabled and save the returned database instance to Database.Companion.global.

Once the Spring support is enabled, the transaction management will be delegated to the Spring framework, so the useTransaction function is not available anymore, we need to use Spring's Transactional annotation instead.

This function also enables the exception translation, which can convert any SQLException thrown by JDBC to Spring's DataAccessException and rethrow it.

Return

the new-created database object.

Parameters

dataSource

the data source used to obtain SQL connections.

dialect

the dialect, auto-detects an implementation by default using JDK ServiceLoader facility.

logger

logger used to output logs, auto-detects an implementation by default.

alwaysQuoteIdentifiers

whether we need to always quote SQL identifiers in the generated SQLs.

generateSqlInUpperCase

whether we need to output the generated SQLs in upper case.