I'm developing VS Code extension and want to get some data from SQL Server database. I've tried many different examples but non of them are working for me.
const Connection = require('tedious').Connection;
const config = {
user: 'ssrs', // tried userName, username
password: 'ssrs',
server: 'localhost',
options: {
database: 'imdb'
}
}
const connection = new Connection(config);
connection.on('connect', function(err: string) {
if (err) {
console.log(err);
} else {
console.log('Connected');
}
});
OR
await sql.connect('mssql://ssrs:ssrs@localhost/imdb')
const result = await sql.query`select 1 as one`
console.dir(result)
OR
const sql = require("mssql");
const conn = new sql.ConnectionPool({
database: "imdb",
server: "localhost",
driver: "msnodesqlv8",
userName: "ssrs",
password: "ssrs"
});
conn.connect().then(() => {
console.log('Connected');
});
ConnectionError: Login failed for user ''.
from Can't connect to SQL Server from my VS Code extension (node.js)
No comments:
Post a Comment