Skip to main content
Version: Next

ConnectionOptions

Connection configuration options for database connections.

@see

Hierarchy

Index

Properties

optionalcharset

charset?: string

Character set for the connection.

optionalclientUrl

clientUrl?: string

Full client connection URL. Overrides individual connection options.

optionalcollate

collate?: string

Collation for the connection.

optionaldbName

dbName?: string

Name of the database to connect to.

optionaldriverOptions

driverOptions?: Dictionary

Additional driver-specific options. The object will be deeply merged with internal driver options.

optionalhost

host?: string

Database server hostname.

optionalmultipleStatements

multipleStatements?: boolean = false

Enable multiple statements in a single query. Required for importing database dump files. Should be disabled in production for security.

optionalname

name?: string

Name of the connection (used for logging when replicas are used).

optionalonCreateConnection

onCreateConnection?: (connection) => Promise<void>

Callback to execute when a new connection is created.


Type declaration

    • (connection): Promise<void>
    • Parameters

      • connection: unknown

      Returns Promise<void>

optionalpassword

password?: string | () => MaybePromise<string>

Database password. Can be a string or a callback function that returns the password. The callback is useful for short-lived tokens from cloud providers.

@example
password: async () => someCallToGetTheToken()

optionalpool

pool?: PoolConfig

Connection pool configuration.

optionalport

port?: number

Database server port number.

optionalschema

schema?: string

Default database schema to use.

optionaluser

user?: string

Database user name.