<legend id='PrmPT'><style id='PrmPT'><dir id='PrmPT'><q id='PrmPT'></q></dir></style></legend>
  1. <i id='PrmPT'><tr id='PrmPT'><dt id='PrmPT'><q id='PrmPT'><span id='PrmPT'><b id='PrmPT'><form id='PrmPT'><ins id='PrmPT'></ins><ul id='PrmPT'></ul><sub id='PrmPT'></sub></form><legend id='PrmPT'></legend><bdo id='PrmPT'><pre id='PrmPT'><center id='PrmPT'></center></pre></bdo></b><th id='PrmPT'></th></span></q></dt></tr></i><div id='PrmPT'><tfoot id='PrmPT'></tfoot><dl id='PrmPT'><fieldset id='PrmPT'></fieldset></dl></div>
      <bdo id='PrmPT'></bdo><ul id='PrmPT'></ul>

    <small id='PrmPT'></small><noframes id='PrmPT'>

    <tfoot id='PrmPT'></tfoot>

      无法使用 Node.js 和 Tedious 连接到 SQL Server

      Cannot connect to SQL Server with Node.js and Tedious(无法使用 Node.js 和 Tedious 连接到 SQL Server)

      <small id='871uK'></small><noframes id='871uK'>

            <tfoot id='871uK'></tfoot>
              <tbody id='871uK'></tbody>
          1. <i id='871uK'><tr id='871uK'><dt id='871uK'><q id='871uK'><span id='871uK'><b id='871uK'><form id='871uK'><ins id='871uK'></ins><ul id='871uK'></ul><sub id='871uK'></sub></form><legend id='871uK'></legend><bdo id='871uK'><pre id='871uK'><center id='871uK'></center></pre></bdo></b><th id='871uK'></th></span></q></dt></tr></i><div id='871uK'><tfoot id='871uK'></tfoot><dl id='871uK'><fieldset id='871uK'></fieldset></dl></div>
              <legend id='871uK'><style id='871uK'><dir id='871uK'><q id='871uK'></q></dir></style></legend>

                <bdo id='871uK'></bdo><ul id='871uK'></ul>
                本文介绍了无法使用 Node.js 和 Tedious 连接到 SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                当我尝试使用 Node.js 和 Tedioius 连接到本地 SQL Server 实例时,出现此错误:

                When I try to use Node.js and Tedioius to connect to a local SQL Server instance I get this error:

                { [ConnectionError: Failed to connect to XXXXX:1433 - connect ECONNREFUSED]
                  name: 'ConnectionError',
                  message: 'Failed to connect to XXXXX:1433 - connect ECONNREFUSED',
                  code: 'ESOCKET' }
                

                这是我的连接对象:

                var config = {
                  userName: 'username',
                  password: 'password',
                  server: 'XXXXX',
                
                  options: {
                    database: 'databasename',
                    instancename: 'SQLEXPRESS'
                  }
                };
                

                我已检查并根据配置管理器启用了 TCP/IP 并在端口 1443 上进行广播.SQL Server Browser 服务也在运行,如果没有,我读到可能会导致此类问题.我已经禁用了我的防病毒软件和防火墙,但这也没有帮助.

                I have checked and TCP/IP is enabled and broadcasting on port 1443 according to Configuration Manager. The SQL Server Browser service is also running, which I read may be causing this type of issue if not. I have disabled my antivirus and firewall and that hasn't helped either.

                有什么见解吗?

                推荐答案

                所以我猜测会发生的是,即使 Tedious 允许您在 'options' 中包含实例名称,它要么不使用它,要么不能使用它因为它需要被使用.在做了一些研究之后,应该发生的事情是,当您为 SQL Server 提供实例名称时,它会将您从端口 1433 重定向到它用于该实例的动态端口.我不知道它使用的是动态端口,但是如果您的实例被命名,则该端口将始终是动态的.1433不知道在哪里看到的,是我弄错了.

                So what I am guessing happens is that even though Tedious lets you include instance name in 'options' it either doesn't use it or can't use it as it needs to be used. After doing some research, what should be happening is when you give SQL Server the instance name, it redirects you from port 1433 to the dynamic port it is using for that instance. I didn't know it was using a dynamic port, but if your instance is named the port will always be dynamic. I don't know where I saw it broadcasting on 1433, that was my mistake.

                要检查动态端口,请看这里:

                To check the dynamic port, look here:

                根据此信息,我将代码更改为:

                From this information, I changed my code to this:

                var config = {
                  userName: 'username',
                  password: 'password',
                  server: 'XXXXX',
                
                  options: {
                    port: 49175,
                    database: 'databasename',
                    instancename: 'SQLEXPRESS'
                  }
                };
                

                现在一切都很好,希望这对某人有所帮助.

                All is good now, hope this helps someone.

                这篇关于无法使用 Node.js 和 Tedious 连接到 SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                SQL query to group by day(按天分组的 SQL 查询)
                Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                sql group by versus distinct(sql group by 与不同)
                How to return a incremental group number per group in SQL(如何在SQL中返回每个组的增量组号)
                Count number of records returned by group by(统计分组返回的记录数)
                SQL GROUP BY CASE statement with aggregate function(带聚合函数的 SQL GROUP BY CASE 语句)

                    <small id='bFspA'></small><noframes id='bFspA'>

                        <legend id='bFspA'><style id='bFspA'><dir id='bFspA'><q id='bFspA'></q></dir></style></legend><tfoot id='bFspA'></tfoot>
                        • <bdo id='bFspA'></bdo><ul id='bFspA'></ul>
                          <i id='bFspA'><tr id='bFspA'><dt id='bFspA'><q id='bFspA'><span id='bFspA'><b id='bFspA'><form id='bFspA'><ins id='bFspA'></ins><ul id='bFspA'></ul><sub id='bFspA'></sub></form><legend id='bFspA'></legend><bdo id='bFspA'><pre id='bFspA'><center id='bFspA'></center></pre></bdo></b><th id='bFspA'></th></span></q></dt></tr></i><div id='bFspA'><tfoot id='bFspA'></tfoot><dl id='bFspA'><fieldset id='bFspA'></fieldset></dl></div>

                            <tbody id='bFspA'></tbody>