Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SqlServerConnectionOptions

Microsoft Sql Server specific connection options.

Hierarchy

Index

Properties

Optional cache

cache: boolean | object

Allows to setup cache options.

Optional cli

cli: object

CLI settings.

Type declaration

  • Optional entitiesDir?: string

    Directory where entities should be created by default.

  • Optional migrationsDir?: string

    Directory where migrations should be created by default.

  • Optional subscribersDir?: string

    Directory where subscribers should be created by default.

Optional connectionTimeout

connectionTimeout: number

Connection timeout in ms (default: 15000).

Optional database

database: string

Database name to connect to.

Optional domain

domain: string

Once you set domain, driver will connect to SQL Server using domain login.

Optional dropSchema

dropSchema: boolean

Drops the schema each time connection is being established. Be careful with this option and don't use this in production - otherwise you'll lose all production data. This option is useful during debug and development.

Optional entities

entities: (string | Function | EntitySchema<any>)[]

Entities to be loaded for this connection. Accepts both entity classes and directories where from entities need to be loaded. Directories support glob patterns.

Optional entityPrefix

entityPrefix: string

Prefix to use on all tables (collections) of this connection in the database.

Optional extra

extra: any

Extra connection options to be passed to the underlying driver.

todo: deprecate this and move all database-specific types into hts own connection options object.

Optional host

host: string

Database host.

Optional logger

logger: "advanced-console" | "simple-console" | "file" | "debug" | Logger

Logger instance used to log queries and events in the ORM.

Optional logging

logging: LoggerOptions

Logging options.

Optional maxQueryExecutionTime

maxQueryExecutionTime: number

Maximum number of milliseconds query should be executed before logger log a warning.

Optional migrations

migrations: (string | Function)[]

Migrations to be loaded for this connection. Accepts both migration classes and directories where from migrations need to be loaded. Directories support glob patterns.

Optional migrationsRun

migrationsRun: boolean

Indicates if migrations should be auto run on every application launch. Alternative to it, you can use CLI and run migrations:run command.

Optional migrationsTableName

migrationsTableName: string

Migrations table name, in case of different name from "migrations". Accepts single string name.

Optional name

name: string

Connection name. If connection name is not given then it will be called "default". Different connections must have different names.

Optional namingStrategy

namingStrategy: NamingStrategyInterface

Naming strategy to be used to name tables and columns in the database.

Optional options

options: object

Extra options

Type declaration

  • Optional abortTransactionOnError?: boolean

    A boolean determining whether to rollback a transaction automatically if any error is encountered during the given transaction's execution. This sets the value for SET XACT_ABORT during the initial SQL phase of a connection (documentation).

  • Optional camelCaseColumns?: boolean

    A boolean, controlling whether the column names returned will have the first letter converted to lower case (true) or not. This value is ignored if you provide a columnNameReplacer. (default: false).

  • Optional cancelTimeout?: number

    The number of milliseconds before the cancel (abort) of a request is considered failed (default: 5000).

  • Optional connectTimeout?: number

    The number of milliseconds before the attempt to connect is considered failed (default: 15000).

  • Optional connectionIsolationLevel?: "READ_UNCOMMITTED" | "READ_COMMITTED" | "REPEATABLE_READ" | "SERIALIZABLE" | "SNAPSHOT"

    The default isolation level for new connections. All out-of-transaction queries are executed with this setting. The isolation levels are available from require('tedious').ISOLATION_LEVEL .

  • Optional cryptoCredentialsDetails?: any

    When encryption is used, an object may be supplied that will be used for the first argument when calling tls.createSecurePair (default: {}).

  • Optional debug?: object

    Debug options

    • Optional data?: boolean

      A boolean, controlling whether debug events will be emitted with text describing packet data details (default: false).

    • Optional packet?: boolean

      A boolean, controlling whether debug events will be emitted with text describing packet details (default: false).

    • Optional payload?: boolean

      A boolean, controlling whether debug events will be emitted with text describing packet payload details (default: false).

    • Optional token?: boolean

      A boolean, controlling whether debug events will be emitted with text describing token stream tokens (default: false).

  • Optional disableOutputReturning?: boolean

    A boolean, controlling whatever to disable RETURNING / OUTPUT statements.

  • Optional enableAnsiNullDefault?: boolean

    If true, SET ANSI_NULL_DFLT_ON ON will be set in the initial sql. This means new columns will be nullable by default. See the T-SQL documentation for more details. (Default: true).

  • Optional encrypt?: boolean

    A boolean determining whether or not the connection will be encrypted. Set to true if you're on Windows Azure. (default: false).

  • Optional fallbackToDefaultDb?: boolean

    By default, if the database requestion by options.database cannot be accessed, the connection will fail with an error. However, if options.fallbackToDefaultDb is set to true, then the user's default database will be used instead (Default: false).

  • Optional isolation?: "READ_UNCOMMITTED" | "READ_COMMITTED" | "REPEATABLE_READ" | "SERIALIZABLE" | "SNAPSHOT"

    The default isolation level that transactions will be run with. The isolation levels are available from require('tedious').ISOLATION_LEVEL. (default: READ_COMMITTED).

  • Optional localAddress?: string

    A string indicating which network interface (ip address) to use when connecting to SQL Server.

  • Optional packetSize?: number

    The size of TDS packets (subject to negotiation with the server). Should be a power of 2. (default: 4096).

  • Optional readOnlyIntent?: boolean

    A boolean, determining whether the connection will request read only access from a SQL Server Availability Group. For more information, see here. (default: false).

  • Optional rowCollectionOnDone?: boolean

    A boolean, that when true will expose received rows in Requests' done* events. See done, doneInProc and doneProc. (default: false) Caution: If many row are received, enabling this option could result in excessive memory usage.

  • Optional rowCollectionOnRequestCompletion?: boolean

    A boolean, that when true will expose received rows in Requests' completion callback. See new Request. (default: false) Caution: If many row are received, enabling this option could result in excessive memory usage.

  • Optional tdsVersion?: string

    The version of TDS to use. If server doesn't support specified version, negotiated version is used instead. The versions are available from require('tedious').TDS_VERSION. (default: 7_4).

  • Optional useColumnNames?: boolean

    A boolean determining whether to return rows as arrays or key-value collections. (default: false).

  • Optional useUTC?: boolean

    A boolean determining whether to pass time values in UTC or local time. (default: true).

Optional password

password: string

Database password.

Optional pool

pool: object

An optional object/dictionary with the any of the properties

Type declaration

  • Optional acquireTimeoutMillis?: number

    Max milliseconds an acquire call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.

  • Optional autostart?: number

    Should the pool start creating resources etc once the constructor is called, (default true)

  • Optional evictionRunIntervalMillis?: number

    How often to run eviction checks. Default: 0 (does not run).

  • Optional fifo?: boolean

    If true the oldest resources will be first to be allocated. If false the most recently released resources will be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. boolean, (default true)

  • Optional idleTimeoutMillis?: number

    The minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due to idle time. Supercedes softIdleTimeoutMillis Default: 30000

  • Optional max?: number

    Maximum number of resources to create at any given time. (default=1)

  • Optional maxWaitingClients?: number

    Maximum number of queued requests allowed, additional acquire calls will be callback with an err in a future cycle of the event loop.

  • Optional min?: number

    Minimum number of resources to keep in pool at any given time. If this is set >= max, the pool will silently set the min to equal max. (default=0)

  • Optional numTestsPerRun?: number

    Number of resources to check each eviction run. Default: 3.

  • Optional priorityRange?: number

    Int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources are available. see example. (default 1)

  • Optional softIdleTimeoutMillis?: number

    Amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any), with the extra condition that at least "min idle" object instances remain in the pool. Default -1 (nothing can get evicted)

  • Optional testOnBorrow?: boolean

    Should the pool validate resources before giving them to clients. Requires that either factory.validate or factory.validateAsync to be specified

Optional port

port: number

Database host port.

Optional replication

replication: object

Replication setup.

Type declaration

Optional requestTimeout

requestTimeout: number

Request timeout in ms (default: 15000). NOTE: msnodesqlv8 driver doesn't support timeouts < 1 second.

Optional schema

schema: string

Database schema.

Optional stream

stream: boolean

Stream recordsets/rows instead of returning them all at once as an argument of callback (default: false). You can also enable streaming for each request independently (request.stream = true). Always set to true if you plan to work with large amount of rows.

Optional subscribers

subscribers: (string | Function)[]

Subscribers to be loaded for this connection. Accepts both subscriber classes and directories where from subscribers need to be loaded. Directories support glob patterns.

Optional synchronize

synchronize: boolean

Indicates if database schema should be auto created on every application launch. Be careful with this option and don't use this in production - otherwise you can lose production data. This option is useful during debug and development. Alternative to it, you can use CLI and run schema:sync command.

Note that for MongoDB database it does not create schema, because MongoDB is schemaless. Instead, it syncs just by creating indices.

type

type: "mssql"

Database type.

Optional url

url: string

Connection url where perform connection to.

Optional username

username: string

Database username.

Generated using TypeDoc