gpt4 book ai didi

sql-server - 请求错误 : { message: 'Requests can only be made in the LoggedIn state, not the SentLogin7WithStandardLogin state' , 代码: 'EINVALIDSTATE' }

转载 作者:搜寻专家 更新时间:2023-10-31 23:17:07 26 4
gpt4 key购买 nike

当使用包 tedious 连接到 MSSQL 时,我的请求测试出现以下错误:

'Requests can only be made in the LoggedIn state, not the SentLogin7WithStandardLogin state', code: 'EINVALIDSTATE'

我的代码(摘自示例:http://pekim.github.io/tedious/getting-started.html):

<!-- testDb.js -->

var Connection = require('tedious').Connection;

var config = {
userName: 'xpto',
password: 'pass',
server: 'myserver',
options: { encrypt: true, database: 'dbname' }
};

var connection = new Connection(config);

connection.on('connect', function (err) {
var Request = require('tedious').Request;
request = new Request("select 42, 'hello world'", function (err, rowCount) {
if (err) {
console.log('ERROR');
console.log(err);
} else {
console.log(rowCount + ' rows');
}
});

request.on('row', function (columns) {
columns.forEach(function (column) {
console.log(column.value);
});
});

connection.execSql(request);
});

enter image description here提前致谢。

最佳答案

我的问题是超时连接。

connect 事件上的

err 参数返回以下消息:

{ message: 'Failed to connect to ip_my_server:1433 in 15000ms', code: 'ETIMEOUT' }

查看 @arthurschreiber 的评论,我在项目的github中的问题: https://github.com/pekim/tedious/issues/344#issuecomment-161320176

谢谢 @arthurschreiber !

关于sql-server - 请求错误 : { message: 'Requests can only be made in the LoggedIn state, not the SentLogin7WithStandardLogin state' , 代码: 'EINVALIDSTATE' },我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34032777/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com