I am getting below error
[ConnectionError: Login failed for user '****'.]
name: 'ConnectionError',
message: 'Login failed for user \'****\'.',
code: 'ELOGIN' } "
Below is the code that i used to connect sql server with nodejs using mssql package.
var sql = require('mssql');
var config = {
server: "localhost\\",// You can use 'localhost\\instance' to connect to named instance
database: "***",
user: "***",
password: "",
port: 1433
};
function getdata() {
var conn = new sql.Connection(config);
var req = new sql.Request(conn);
conn.connect(function (err) {
If (err) {
console.log(err);
return;
}
req.query("select * From" ,function (err,recordset) {
If (err) {
console.log(err);
return;
}
else {
console.log(recordset);
}
conn.close();
enter code here
});
});
}
getdata();
Below is the message displayed when i add console to "conn" ,Kindly let me know if i have missed anything.
config:
{ server: '',
database: '',
user: '',
password: '',
port: 1433,
driver: 'tedious',
options: {},
stream: false,
parseJSON: false },
driver:
{ Connection:
{ [Function: TediousConnection]
EventEmitter: [Object],
usingDomains: false,
defaultMaxListeners: 10,
init: [Function],
listenerCount: [Function],
__super__: [Object] },
Transaction:
{ [Function: TediousTransaction]
EventEmitter: [Object],
usingDomains: false,
defaultMaxListeners: 10,
init: [Function],
listenerCount: [Function],
__super__: [Object] },
Request:
{ [Function: TediousRequest]
EventEmitter: [Object],
usingDomains: false,
defaultMaxListeners: 10,
init: [Function],
listenerCount: [Function],
__super__: [Object] },
fix: [Function] } }
started