Tedious
    Preparing search index...

    Interface ConnectionOptions

    interface ConnectionOptions {
        abortTransactionOnError?: boolean;
        appName?: string;
        camelCaseColumns?: boolean;
        cancelTimeout?: number;
        columnNameReplacer?: (
            colName: string,
            index: number,
            metadata: Metadata,
        ) => string;
        connectionIsolationLevel?: number;
        connectionRetryInterval?: number;
        connector?: () => Promise<Socket>;
        connectTimeout?: number;
        cryptoCredentialsDetails?: SecureContextOptions;
        database?: string;
        datefirst?: number;
        dateFormat?: string;
        debug?: DebugOptions;
        enableAnsiNull?: boolean;
        enableAnsiNullDefault?: boolean;
        enableAnsiPadding?: boolean;
        enableAnsiWarnings?: boolean;
        enableArithAbort?: boolean;
        enableConcatNullYieldsNull?: boolean;
        enableCursorCloseOnCommit?: boolean | null;
        enableImplicitTransactions?: boolean;
        enableNumericRoundabort?: boolean;
        enableQuotedIdentifier?: boolean;
        encrypt?: string | boolean;
        fallbackToDefaultDb?: boolean;
        instanceName?: string;
        isolationLevel?: number;
        language?: string;
        localAddress?: string;
        lowerCaseGuids?: boolean;
        maxRetriesOnTransientErrors?: number;
        multiSubnetFailover?: boolean;
        packetSize?: number;
        port?: number;
        readOnlyIntent?: boolean;
        requestTimeout?: number;
        rowCollectionOnDone?: boolean;
        rowCollectionOnRequestCompletion?: boolean;
        serverName?: string;
        tdsVersion?: string;
        textsize?: number;
        trustServerCertificate?: boolean;
        useColumnNames?: boolean;
        useUTC?: boolean;
        workstationId?: string;
    }
    Index

    Properties

    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.

    appName?: string

    Application name used for identifying a specific application in profiling, logging or tracing tools of SQLServer.

    (default: Tedious)

    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).

    cancelTimeout?: number

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

    (default: 5000).

    columnNameReplacer?: (
        colName: string,
        index: number,
        metadata: Metadata,
    ) => string

    A function with parameters (columnName, index, columnMetaData) and returning a string. If provided, this will be called once per column per result-set. The returned value will be used instead of the SQL-provided column name on row and meta data objects. This allows you to dynamically convert between naming conventions.

    (default: null)

    connectionIsolationLevel?: number

    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.

    • READ_UNCOMMITTED
    • READ_COMMITTED
    • REPEATABLE_READ
    • SERIALIZABLE
    • SNAPSHOT

    (default: READ_COMMITTED).

    connectionRetryInterval?: number

    Number of milliseconds before retrying to establish connection, in case of transient failure.

    (default:500)

    connector?: () => Promise<Socket>

    Custom connector factory method.

    (default: undefined)

    connectTimeout?: number

    The number of milliseconds before the attempt to connect is considered failed

    (default: 15000).

    cryptoCredentialsDetails?: SecureContextOptions

    When encryption is used, an object may be supplied that will be used for the first argument when calling tls.createSecureContext.

    (default: {})

    database?: string

    Database to connect to (default: dependent on server configuration).

    datefirst?: number

    Sets the first day of the week to a number from 1 through 7.

    dateFormat?: string

    A string representing position of month, day and year in temporal datatypes.

    (default: mdy)

    debug?: DebugOptions
    enableAnsiNull?: boolean

    A boolean, controls the way null values should be used during comparison operation.

    (default: true)

    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

    (default: true).

    enableAnsiPadding?: boolean

    A boolean, controls if padding should be applied for values shorter than the size of defined column.

    (default: true)

    enableAnsiWarnings?: boolean

    If true, SQL Server will follow ISO standard behavior during various error conditions. For details, see documentation

    (default: true)

    enableArithAbort?: boolean

    Ends a query when an overflow or divide-by-zero error occurs during query execution. See documentation for more details.

    (default: true)

    enableConcatNullYieldsNull?: boolean

    A boolean, determines if concatenation with NULL should result in NULL or empty string value, more details in documentation

    (default: true)

    enableCursorCloseOnCommit?: boolean | null

    A boolean, controls whether cursor should be closed, if the transaction opening it gets committed or rolled back.

    (default: null)

    enableImplicitTransactions?: boolean

    A boolean, sets the connection to either implicit or autocommit transaction mode.

    (default: false)

    enableNumericRoundabort?: boolean

    If false, error is not generated during loss of precision.

    (default: false)

    enableQuotedIdentifier?: boolean

    If true, characters enclosed in single quotes are treated as literals and those enclosed double quotes are treated as identifiers.

    (default: true)

    encrypt?: string | boolean

    A string value that can be only set to 'strict', which indicates the usage TDS 8.0 protocol. Otherwise, a boolean determining whether or not the connection will be encrypted.

    (default: true)

    fallbackToDefaultDb?: boolean

    By default, if the database requested by database cannot be accessed, the connection will fail with an error. However, if fallbackToDefaultDb is set to true, then the user's default database will be used instead

    (default: false)

    instanceName?: string

    The instance name to connect to. The SQL Server Browser service must be running on the database server, and UDP port 1434 on the database server must be reachable.

    (no default)

    Mutually exclusive with port.

    isolationLevel?: number

    The default isolation level that transactions will be run with.

    The isolation levels are available from require('tedious').ISOLATION_LEVEL.

    • READ_UNCOMMITTED
    • READ_COMMITTED
    • REPEATABLE_READ
    • SERIALIZABLE
    • SNAPSHOT

    (default: READ_COMMITTED).

    language?: string

    Specifies the language environment for the session. The session language determines the datetime formats and system messages.

    (default: us_english).

    localAddress?: string

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

    lowerCaseGuids?: boolean

    A boolean determining whether to parse unique identifier type with lowercase case characters.

    (default: false).

    maxRetriesOnTransientErrors?: number

    The maximum number of connection retries for transient errors.

    (default: 3).

    multiSubnetFailover?: boolean

    Sets the MultiSubnetFailover = True parameter, which can help minimize the client recovery latency when failovers occur.

    (default: false).

    packetSize?: number

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

    (default: 4096).

    port?: number

    Port to connect to (default: 1433).

    Mutually exclusive with instanceName

    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).

    requestTimeout?: number

    The number of milliseconds before a request is considered failed, or 0 for no timeout.

    As soon as a response is received, the timeout is cleared. This means that queries that immediately return a response have ability to run longer than this timeout.

    (default: 15000).

    rowCollectionOnDone?: boolean

    A boolean, that when true will expose received rows in Requests done related events:

    (default: false)

    Caution: If many row are received, enabling this option could result in excessive memory usage.

    rowCollectionOnRequestCompletion?: boolean

    A boolean, that when true will expose received rows in Requests' completion callback.See Request.constructor.

    (default: false)

    Caution: If many row are received, enabling this option could result in excessive memory usage.

    serverName?: string
    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.

    • 7_1 (deprecated, support will be removed in a future version)
    • 7_2
    • 7_3_A
    • 7_3_B
    • 7_4

    (default: 7_4)

    textsize?: number

    Specifies the size of varchar(max), nvarchar(max), varbinary(max), text, ntext, and image data returned by a SELECT statement.

    (default: 2147483647)

    trustServerCertificate?: boolean

    If "true", the SQL Server SSL certificate is automatically trusted when the communication layer is encrypted using SSL.

    If "false", the SQL Server validates the server SSL certificate. If the server certificate validation fails, the driver raises an error and terminates the connection. Make sure the value passed to serverName exactly matches the Common Name (CN) or DNS name in the Subject Alternate Name in the server certificate for an SSL connection to succeed.

    (default: false)

    useColumnNames?: boolean

    A boolean determining whether to return rows as arrays or key-value collections.

    (default: false).

    useUTC?: boolean

    A boolean determining whether to pass time values in UTC or local time.

    (default: true).

    workstationId?: string

    The workstation ID (WSID) of the client, default os.hostname(). Used for identifying a specific client in profiling, logging or tracing client activity in SQLServer.

    The value is reported by the TSQL function HOST_NAME().