Fork me on GitHub

Frequently Encountered Problems (F.E.Q.)

Any Problem

First step to debug any problems is to ensure that tedious is up to date.

If you're using tediousjs/mssql, make sure it's up to date, as well as its tedious dependency in package.json.
Note: tediousjs/mssql is no longer being actively maintained


Setting up config

To set up a configuration object for a Connection to SQL server, see connection page.

To set up configuration for running tests locally, see tests page.


Connection to local SQL Server

SQL Server Configurations

Ensure SQL Server Browser and SQL Server Agent is running (Agent can only run on SQL Server Developer/Enterprise, NOT SQL Server Express).

Enable TCP/IP port via SQL Configuration Manager (C:\Windows\SysWOW64\SQLServerManager14.msc for windows).

Ensure user is enabled: SQL Server Management Studio -> Security -> logins -> enable user (that matches the userName in the 'config' object in Tedious).

Tedious Configurations

Ensure port number of the server matches the port number in the 'config' object, and ensure the port number is in the options field of the config object itself, and NOT the Authentication options.

E.g.,

        var config = {
            server: 'localhost',
            authentication: {
              type: 'default',
              options: {
                userName: 'sa', //Username 'sa' was added to server 'users'
                password: 'Password_123', //Password set up during addition of 'sa' user. 
              }
            },
            options: {		
              port: 60543, //This port was specific to my server. Yours might be different. 
            }
          };
        

Remote Azure Connection

Tedious version 6.3.0 and above is required for MSI Authentication.

Check configuration in Active Directory's Firewall.


"Requests can only be made in the LoggedIn state, not the SentClientRequest state"

Only one query can be executed on a connection at a time. You need to wait until the request callback is executed, either with an error or with the result before making another request.
(Refer to the TDS protocol state diagram [bottom-half of the diagram] for a high level understanding of the TDS lifecycle).


tediousjs > tedious-connection-pool and node-mssql

Both of these repositories are not being actively maintained, however, still valid to some extent.

If using either of these, ensure that you're using the latest versions and that their package.json has the latest tedious version as its dependency


JavaScript number type limitation

If the number you're trying to insert is not in -9007199254740991 and 9007199254740991 (inclusive), use VarChar type instead.


Connecting to SQL Server 2000

use TDS version 7_1 specified in the config:

        var config = {
            options: {		
                ...,
                tdsVersion: '7_1'
            }
          };
        

Other

For more complex issues, please raise an issue on the github page!

If you've found a solution to what you think may be a common problem, please make a pull request on gh-pages branch with the problem and solution, or raise an issue .