Reputation: 11
Please help me, I've been suffering for several hours, but I can't connect to the database in SQL Server Management Studio 20. I have already configured SQL and enabled TCP IP, but it still does not work.
const { Connection, Request } = require("tedious");
// Настройки подключения к базе данных
const config = {
authentication: {
options: {
userName: "server",
password: "12345678",
},
type: "default",
},
server: "WIN-BOEG8IKMEF7",
options: {
instanceName: "SQLEXPRESS",
database: "Zaivki",
rowCollectionOnRequestCompletion: true,
},
};
// Создание подключения
const connection = new Connection(config);
// Обработка событий подключения
connection.on("connect", (err) => {
if (err) {
console.error("Ошибка подключения: ", err);
} else {
console.log("Подключение успешно!");
executeSQL();
}
});
Error stacktrace:
Ошибка подключения: ConnectionError: Failed to connect to WIN-BOEG8IKMEF7\SQLEXPRESS in 15000ms
at Connection.connectTimeout (F:\zaivka\node_modules\tedious\lib\connection.js:1222:26)
at Timeout._onTimeout (F:\zaivka\node_modules\tedious\lib\connection.js:1167:12)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7) {
code: 'ETIMEOUT'
}
Configuration in SQL Server Management Studio:
Upvotes: 1
Views: 52