mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
23 lines
576 B
JavaScript
23 lines
576 B
JavaScript
var Connection = require('tedious').Connection;
|
|
var Request = require('tedious').Request;
|
|
var TYPES = require('tedious').TYPES;
|
|
|
|
// Create connection to database
|
|
var config = {
|
|
userName: 'sa', // update me
|
|
password: 'your_password', // update me
|
|
server: 'localhost',
|
|
options: {
|
|
database: 'SampleDB'
|
|
}
|
|
}
|
|
var connection = new Connection(config);
|
|
|
|
// Attempt to connect and execute queries if connection goes through
|
|
connection.on('connect', function(err) {
|
|
if (err) {
|
|
console.log(err);
|
|
} else {
|
|
console.log('Connected');
|
|
}
|
|
}); |