Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 无法通过express ERROR“连接到sql数据库;ConnectionError:未能在上查找实例。-再次使用getaddrinfo EAI。初始连接“;_Sql Server_Reactjs_Sql Server Express - Fatal编程技术网

Sql server 无法通过express ERROR“连接到sql数据库;ConnectionError:未能在上查找实例。-再次使用getaddrinfo EAI。初始连接“;

Sql server 无法通过express ERROR“连接到sql数据库;ConnectionError:未能在上查找实例。-再次使用getaddrinfo EAI。初始连接“;,sql-server,reactjs,sql-server-express,Sql Server,Reactjs,Sql Server Express,您好,我的代码运行良好,但需要更新数据库到一个新版本的无关问题 因此,我已将sql server更新为18 然而,现在我似乎无法将我的react站点连接到我的新数据库 我已检查tcp/ip是否已启用。 我已经启用了管道。 我已检查用户是否已映射到安全数据库。 我已检查用户是否为dbreator。 在数据库本身中,我甚至给了他们所有的成员身份和所有拥有的模式。 在服务器管理工具中,我发现它没有连接到端口,所以我手动添加了1433 这是我的配置的基本获取路径 const config = { u

您好,我的代码运行良好,但需要更新数据库到一个新版本的无关问题

因此,我已将sql server更新为18

然而,现在我似乎无法将我的react站点连接到我的新数据库

我已检查tcp/ip是否已启用。 我已经启用了管道。 我已检查用户是否已映射到安全数据库。 我已检查用户是否为dbreator。 在数据库本身中,我甚至给了他们所有的成员身份和所有拥有的模式。 在服务器管理工具中,我发现它没有连接到端口,所以我手动添加了1433

这是我的配置的基本获取路径

const config = {
  user: "sas",
  password: "Mypassword123",
  server: ".\\MSSQLSERVER1000", // You can use 'localhost\\instance' to connect to named instance
  database: "TestDBWebsite",
  port: 1433
};

app.use(bodyParser.json());

//AdminView users just pulls the users from the database
app.get("/admin-view-users", function(req, res) {
  // connect to your database
  sql.connect(config, function(err) {
    if (err) console.log(err + "initial connection");

    // create Request object
    var request = new sql.Request();

    // query to the database and get the records
    request.query("select * from Users ", function(err, recordset) {
      if (err) console.log(err);

      // send records as a response

      res.json(recordset);
    });
  });
});

这是我收到的错误

ConnectionError: Failed to lookup instance on . - getaddrinfo EAI_AGAIN  initial connection
这可能是什么原因造成的?我该如何解决这个问题?在初始代码中唯一改变的是数据库表名,它们在其中被更新,当然配置也被更新

感谢您的回答。

这是否相关?或者这是相关的?还是这个