[英]ConnectionError [SequelizeConnectionError]: Failed to connect to :1433 - Could not connect (sequence) local machine window 10
***** mssql db connected sucessfully **** customers (node:116) [DEP0118] DeprecationWarning: The provided hostname "" is not a valid hostname, and is supported in the dns module solely for compatibility.
***** mssql db 连接成功 **** 客户 (node:116) [DEP0118] DeprecationWarning: 提供的主机名“”不是有效的主机名,仅出于兼容性考虑,dns 模块支持。 (Use
node --trace-deprecation...
to show where the warning was created) ConnectionError [SequelizeConnectionError]: Failed to connect to:1433 - Could not connect (sequence) at ConnectionManager.connect (H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\mssql\connection-manager.js:139:17) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async ConnectionManager._connect (H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:318:24) at async H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:250:32(使用
node --trace-deprecation...
显示警告的创建位置) ConnectionError [SequelizeConnectionError]: Failed to connect to:1433 - 无法在 ConnectionManager.connect 连接(序列)(H:\codeoptimalsolutions\socialApp\backend \node_modules\sequelize\lib\dialects\mssql\connection-manager.js:139:17) 在 processTicksAndRejections (internal/process/task_queues.js:93:5) at async ConnectionManager._connect (H:\codeoptimalsolutions\socialApp\backend \node_modules\sequelize\lib\dialects\abstract\connection-manager.js:318:24) 在异步 H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:250: 32
at async ConnectionManager.getConnection (H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:280:7) at async H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\sequelize.js:613:26 at async MSSqlQueryInterface.select (H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\abstract\query-interface.js:953:12) at async Function.findAll (H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\model.js:1753:21) { parent: ConnectionError: Failed to connect to:1433 - Could not connect (sequence) at ConnectionError (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\errors.js:13:12) at Connection.socketError (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connection.js:1641:56)在异步 ConnectionManager.getConnection (H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:280:7) 在异步 H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\ lib\sequelize.js:613:26 在异步 MSSqlQueryInterface.select (H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\dialects\abstract\query-interface.js:953:12) 在异步 Z86408593C34AF757FDD.findAllF29 H:\codeoptimalsolutions\socialApp\backend\node_modules\sequelize\lib\model.js:1753:21) { 父级:ConnectionError:无法连接到:1433 - 无法在 ConnectionError 处连接(序列)(H:\codeoptimalsolutions\socialApp \backend\node_modules\tedious\lib\errors.js:13:12) 在 Connection.socketError (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connection.js:1641:56)
at H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connection.js:1400:21 at SequentialConnectionStrategy.connect (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:129:14) at H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:201:80 at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'ESOCKET' }, original: ConnectionError: Failed to connect to:1433 - Could not connect (sequence) at ConnectionError (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\errors.js:13:12) at Connection.socketError (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connection.js:1641:56)在 H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connection.js:1400:21 在 SequentialConnectionStrategy.connect (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:129:14 ) 在 H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:201:80 在 processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'ESOCKET' }, original: ConnectionError :无法连接到:1433 - 在 Connection.socketError (H:\codeoptimalsolutions\ socialApp\backend\node_modules\tedious\lib\connection.js:1641:56)
at H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connection.js:1400:21 at SequentialConnectionStrategy.connect (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:129:14) at H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:201:80 at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'ESOCKET' } }在 H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connection.js:1400:21 在 SequentialConnectionStrategy.connect (H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:129:14 ) 在 H:\codeoptimalsolutions\socialApp\backend\node_modules\tedious\lib\connector.js:201:80 在 processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'ESOCKET' } }
I tried我试过了
TCP/IP is enabled TCP/IP 已启用
checked some answers ntng found all give me advice to enable TCP/IP检查了一些答案 ntng 发现都给了我启用 TCP/IP 的建议
var sequelize = new Sequelize(DBNAME,USERNAME,PASSWORD,{ dialect: 'mssql', host: hostname, port: 1433, logging: false, dialectOptions: { requestTimeout: 30000, encrypt: true } })
When i try to run get query then got this error当我尝试运行获取查询时出现此错误
Models.Customer.findAll({}, {}, {}).then(data=>{
console.log(data);
}).catch(err => { //console.log("err",err);
console.log(err);
});
Bit of a stab in the dark because I don't feel there's enough information but the error states DeprecationWarning: The provided hostname "" is not a valid hostname, and is supported in the dns module solely for compatibility.
在黑暗中有点刺,因为我觉得没有足够的信息,但错误状态
DeprecationWarning: The provided hostname "" is not a valid hostname, and is supported in the dns module solely for compatibility.
Followed by a number of connection errors.其次是一些连接错误。
Your sequelize config contains:您的续集配置包含:
host: hostname,
So it looks to me as though "hostname" is returning an empty string but is necessary for the connection to proceed.因此,在我看来,“主机名”似乎返回了一个空字符串,但对于继续进行连接是必要的。
Edit to be a little more useful:编辑更有用一点:
The sequelize documentation indicates that it defaults to localhost if not set , but here (I suspect) you are setting host name to an empty string. sequelize 文档表明它默认为 localhost if not set ,但在这里(我怀疑)您将主机名设置为空字符串。 Try setting hostname explicitly to the database host and see if it connects.
尝试将主机名显式设置为数据库主机并查看它是否连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.