Javascript SQL server Database connections example

In order to get data from database, we need to connect to the database. If you are aware of Java, then you might be aware of the JDBC which is used to connect to the database and read data. Similarly, NPM has a module named tedious which can be used to get data from the database with javascript operations. In this page we have example of How to use Tedious to conncet to the database and perform SQL Database validations using Tedious.
 

This  returns data from database and that can be used further for any assertion in database testing automation.  This is just a sample database connection and validation. You can change it to suite your requirement. 

These code blocks are tested with real database connections so you can copy and reuse them after making some changes at identified places

npm Tedious connection example