Node.js - mssql bağlantısı problemi
Merhabalar. İnternetten https://www.youtube.com/watch?v=MLcXfRH1YzE gibi birçok yöntemi denememe rağmen mssql ve node.js bağlantısı kuramadım. Bu konuda yardımcı olabilir misiniz ?
En son denediğim kod :
var sql = require('mssql');
var sqlConfig = {
server: 'DESKTOP-LCEVO44',
database: 'Person',
user: 'sa',
password: '123456789',
};
(async function () {
try {
console.log("sql connecting......")
let pool = await sql.connect(sqlConfig)
let result = await pool.request()
.query('select * from People') // subject is my database table name
console.log(result)
} catch (err) {
console.log(err);
}
})()
kodun verdiği hata / çıktı :
sql connecting......
{ ConnectionError: Failed to connect to DESKTOP-LCEVO44:1433 - Could not connect (sequence)
at Connection.tedious.once.err (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\mssql\lib\tedious.js:244:17)
at Object.onceWrapper (events.js:286:20)
at Connection.emit (events.js:198:13)
at Connection.socketError (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connection.js:1095:12)
at Connector.execute (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connection.js:961:21)
at SequentialConnectionStrategy.connect (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connector.js:121:7)
at Socket.onError (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connector.js:136:12)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
code: 'ESOCKET',
originalError:
{ ConnectionError: Failed to connect to DESKTOP-LCEVO44:1433 - Could not connect (sequence)
at ConnectionError (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\errors.js:13:12)
at Connection.socketError (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connection.js:1095:28)
at Connector.execute (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connection.js:961:21)
at SequentialConnectionStrategy.connect (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connector.js:121:7)
at Socket.onError (C:\Users\oofka\source\repos\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\tedious\lib\connector.js:136:12)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
message:
'Failed to connect to DESKTOP-LCEVO44:1433 - Could not connect (sequence)',
code: 'ESOCKET' },
name: 'ConnectionError' }