English | 简体中文

api-docs / org.ktorm.global / connectGlobally

connectGlobally

fun Database.Companion.connectGlobally(
    dialect: SqlDialect = detectDialectImplementation(),
    logger: Logger = detectLoggerImplementation(),
    alwaysQuoteIdentifiers: Boolean = false,
    generateSqlInUpperCase: Boolean? = null,
    connector: () -> Connection
): Database
(source code)

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

Connect to a database by a specific connector function and save the returned database instance
to Database.Companion.global.

Parameters

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.

connector - the connector function used to obtain SQL connections.

Return
the new-created database object.

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

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

Connect to a database using a DataSource and save the returned database instance to Database.Companion.global.

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.

Return
the new-created database object.

fun Database.Companion.connectGlobally(
    url: String,
    driver: String? = null,
    user: String? = null,
    password: String? = null,
    dialect: SqlDialect = detectDialectImplementation(),
    logger: Logger = detectLoggerImplementation(),
    alwaysQuoteIdentifiers: Boolean = false,
    generateSqlInUpperCase: Boolean? = null
): Database
(source code)

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

Connect to a database using the specific connection arguments and save the returned database instance
to Database.Companion.global.

Parameters

url - the URL of the database to be connected.

driver - the full qualified name of the JDBC driver class.

user - the username of the database.

password - the password of the database.

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.

Return
the new-created database object.