Node-mssql: How to pass `enableArithAbort` to Tedious?

Created on 9 Jul 2019  路  13Comments  路  Source: tediousjs/node-mssql

Expected behaviour:

I would like to pass the "enableArithAbort" config option value to Tedious, it makes a lot of difference in my case: the query takes 1 second when it's on, 1+ minute when it's off.

Actual behaviour:

I tried the following:

await this.sqlClient.connect({
       ...
        "enableArithAbort": true
      });

But it doesn't work, enableArithAbort seems to be absent from the config object when it's checked.

If I manually edit connection.js like this:

    if (true) {
      options.push('set arithabort on');
    } else if (this.config.options.enableArithAbort === false) {
      options.push('set arithabort off');
    }

The option is set correctly and the performance goes through the roof.

Configuration:

Not sure what to put that's relevant here.

Software versions

$ node --version
v10.15.1

mssql@^5.1.0:
  version "5.1.0"
connection strings

Most helpful comment

This is kinda an issue:

tedious deprecated The default value for `config.options.enableArithAbort` will change from `false` to `true` in the next major version of `tedious`. Set the value to `true` or `false` explicitly to silence this message. webpack:\node_modules\mssql\lib\tedious\connection-pool.js?, <anonymous>:61:23

For those of us trying to use this module on azure, a big ol warning stuffed into our logs every startup is not ... thrilling. :)

All 13 comments

Looks like you know what to do, would you mind to please submit a PR that enables this functionality?

It's ok actually, when coding the PR I figured out that enableArithAbort must be passed in the options property.

Example:

      const pool = await this.sqlClient.connect({
        ...
        "options": {
          "encrypt": true,
          "enableArithAbort": true
        },
        ...
      });

Thanks for your help 馃槂

I am still confused about this, since I'm not aware of any way to pass ARITHABORT to the connection string (I'm using the ConnectionPool constructor with the connection string argument). Is there a way to pass this through the connection string, or should we simply tolerate the warning and wait for the next major version?

Bump.

this worked for me

mdPool = new sql.ConnectionPool({
            user: 'sa',
            password: '********',
            server: 'localhost',
            port: 32768,
            database: 'UnityMD',
            options: {
                "enableArithAbort": true
            }
        });

I am still confused about this, since I'm not aware of any way to pass ARITHABORT to the connection string (I'm using the ConnectionPool constructor with the connection string argument). Is there a way to pass this through the connection string, or should we simply tolerate the warning and wait for the next major version?

Same here, what if I don't want to use the object and need to use a connectionString instead?

At the moment it's not possible through connection strings - it's an area that needs improvement but it's not particularly high up the list right now

This is kinda an issue:

tedious deprecated The default value for `config.options.enableArithAbort` will change from `false` to `true` in the next major version of `tedious`. Set the value to `true` or `false` explicitly to silence this message. webpack:\node_modules\mssql\lib\tedious\connection-pool.js?, <anonymous>:61:23

For those of us trying to use this module on azure, a big ol warning stuffed into our logs every startup is not ... thrilling. :)

It's not a big issue, though - you can just parse the connection string and set that value manually on the parsed string and then pass that to the connection pool.

It's also not been enough of an issue for anyone to submit a patch for it

I'm just filtering out the log line. Not a big issue. Just surprising that no one working on the project is using a hosted service with connection strings.

I do, I'm using it with azure functions

But you're parsing the connection string that azure securely hands you into fields for the options struct?

No, I just don't care about this error at the moment...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aerze picture aerze  路  3Comments

mhunting picture mhunting  路  6Comments

andrewmcgivery picture andrewmcgivery  路  5Comments

PhantomRay picture PhantomRay  路  4Comments

praveen2916 picture praveen2916  路  3Comments