mssql-nxg-cg
v1.0.2
Published
Microsoft SQL Server client for Node.js
Downloads
6
Readme
Connection
In Node.js library to connect with Mssql and get the access from the Database Connection.
Installation
To install Mssql connection library.
EXAMPLE OF CONNECT TO MSSQL
const MSSQLConnector = require('mssql-nxg-cg');
// Define MSSQL configuration const sqlConfig = { user: 'your_username', password: 'your_password', server: 'your_server', database: 'your_database',, options: { encrypt: true, // Use this if you're on Windows Azure trustServerCertificate: true } };
async function getDataFromMSSQL() { try { // Create an instance of MSSQLConnector const mssqlConnector = new MSSQLConnector(sqlConfig);
// Define SQL query to retrieve data
const query = 'SELECT * FROM BankCustomers';
// Retrieve data from MSSQL
const data = await mssqlConnector.getData(query);
console.log('Retrieved data:', data);
} catch (error) {
console.error('Error retrieving data:', error);
}
}
getDataFromMSSQL(); this is the example of login with credentials and getting the data from the MSSQL