gpt4 book ai didi

sql-server - SQL server management studio - 如何使用连接字符串连接到 SQL server?

转载 作者:行者123 更新时间:2023-12-04 21:33:30 35 4
gpt4 key购买 nike

我无法使用 SQL Server Management Studio 连接到 SQL Server。
我有一个连接字符串:

 <add name="AccountConnStr" connectionString="Data Source=MyIP;Initial Catalog=nvm;Persist Security Info=True;User ID=myID;Password=myPassWord" providerName="System.Data.SqlClient" />

我尝试通过在服务器名中输入 myIP、在登录名中输入 MyID、在密码中输入 myPassword 来进行连接,但仍然无法连接。这是结果:

enter image description here

有没有人有想法?

非常感谢。

最佳答案

因为您使用用户名和密码连接到数据库,所以您应该将连接字符串更改为如下所示:

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=False;
User ID=myDomain\myUsername;Password=myPassword;

如果你想知道为什么:

Integrated Security When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication. Recognized values are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true. If User ID and Password are specified and Integrated Security is set to true, the User ID and Password will be ignored and Integrated Security will be used.



附注

如果这没有帮助,那么您也可以检查一下:

确保您的数据库引擎配置为接受远程
连接:

Start > All Programs > SQL Server 2005 > Configuration

Tools > SQL Server Surface Area Configuration Click on Surface Area

Configuration for Services and Connections Select the instance that is

having a problem > Database Engine > Remote Connections Enable local and remote connections Restart instance



您可能需要在防火墙上为您使用的 SQL Server 实例和端口创建异常(exception):

Start > Run > Firewall.cpl Click on exceptions tab Add sqlservr.exe

(typically located in C:\Program Files (x86)\Microsoft SQL

Server\MSSQL.x\MSSQL\Bin, check your installs for the actual folder

path) and port (default is 1433) Check your connection string as well

关于sql-server - SQL server management studio - 如何使用连接字符串连接到 SQL server?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44881968/

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