且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何通过局域网连接sql server数据库

更新时间:2023-02-22 14:27:39

由于数据库不支持 '\SERVER\c...' 参数,我不得不附加数据库,启用 TCP/IP 和 SQL 浏览器后,我必须通过安全性创建登录并将其添加到附加的数据库文件中,因为身份验证必须是 SQL 而不是 Windows.而且我还授予了该帐户的读/写权限.然后在子系统上,我通过 SSMS 确认连接到帐户,登录名连接到 SERVER(这是远程计算机的名称).

As database does not support the '\SERVER\c...' parameters, i had to attach the database, after enabling TCP/IP and SQL Browser, i had to create a login through security and add it to the attached database file because authentication must be SQL not windows. And i also gave read/write privileges to the account. Then on the child system, i confirmed connection to the account through SSMS with the login connecting to SERVER (which is the remote computer's name).

注意:您必须能够ping 远程系统和安装的SQL Server Express R2.我尝试使用 SQL Server Express,但没有取得进展.www.connectionstrings.com/sql-server-2008 获取更多连接字符串

Note: you must be able to ping the remote systems and SQL Server Express R2 installed. I tried with SQL Server Express but did not get a head way. www.connectionstrings.com/sql-server-2008 for more connection string

然后我使用此连接字符串进行远程连接,使集成安全性和用户实例 = false 与本地连接不同.

Then i used this connection string to connect remotely, making integrated security and user instance = false unlike if i were connecting locally.

 Data Source=SERVER\SQLEXPRESS,1433;Database=DATABASEFILE.MDF;Integrated Security=False;Network Library=dbmssocn;Connect Timeout=30;User Instance=False;user='USERNAME';password='PASSWORD'