连接到共享文件夹中的sql数据库 [英] connect to a sql database which is in a shared folder

查看:209
本文介绍了连接到共享文件夹中的sql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的C#Windows应用程序的连接字符串有问题.我的数据库在sql server 2005中.我将数据库复制到了一个共享文件夹中.我正在为SQL函数使用SQLHELPER类.
连接字符串为:

I have an issue with the connection string of my C# windows app.My database is in sql server 2005.I copied the db to a shared folder.I am using SQLHELPER class for sql functions.
The connection string is:

public static readonly string CONN_STRING=" Data Source=128.12.14.128,1433;Network Library=DBMSSOCN;Initial Catalog=db;User ID=sa;Password=sa123";


该数据库位于\\ 128.12.14.128 \\ NewFolder1 \\ db.mdf& db.ldf

现在,当我尝试运行我的应用程序时,错误显示:

建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称正确,并且已将SQL Server配置为允许远程连接. (提供者:TCP提供程序,错误:0-无法建立连接,因为目标计算机主动拒绝了它.)

现在任何人都可以帮助我吗?


The db is in \\128.12.14.128\\NewFolder1\\db.mdf & db.ldf

Now when i tried to run my app, error shows:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)

Now can any one help me?

推荐答案

我认为您的提示是服务器....无法访问."确保您的应用程序具有对共享文件夹的读/写访问权限,并且要确保传入的用户凭据也可以访问有问题的数据库.
使用网站 www.connectionstrings.com 了解更多信息.
I think your hint is the "The server .... was not accessible." Make sure that your application has access read/write access to the share folder and that the user credentials being passed in have access to the db in question as well.
Use the site www.connectionstrings.com for more information.


基本上,当您无法连接到SQL Server时,问题可能是:
1)网络问题,
2)SQL Server配置问题.
3)防火墙问题,
4)客户端驱动程序问题,
5)应用程序配置问题.
6)身份验证和登录问题.

Basically, when you failed to connect to your SQL Server, the issue could be:
1) Network issue,
2) SQL Server configuration issue.
3) Firewall issue,
4) Client driver issue,
5) Application configuration issue.
6) Authentication and logon issue.


根据错误消息,您不允许远程连接到该计算机,因此请更改设置中的选项.

检查这些
解决SQL连接问题的步骤 [ ^ ]
SQL Server 2005连接性问题疑难解答-第一部分 [对SQL Server 2005中的连接问题进行故障排除-第二部分 [ ^ ]
对SQL Server 2005中的连接问题进行故障排除-第III部分 [ ^ ]

顺便说一句,还要检查这堆中是否有将来的错误


Based on the error message you didn''t allow the remote connection to that machine so change the options in settings.

Check these
Steps to troubleshoot SQL connectivity issues[^]
SQL Server 2005 Connectivity Issue Troubleshoot - Part I[^]
Troubleshoot Connectivity Issue in SQL Server 2005 - Part II[^]
Troubleshoot Connectivity Issue in SQL Server 2005 - Part III[^]

BTW check this bunch also for future errors


默认情况下,您无法通过网络连接到sql文件,只能通过网络连接到sql实例.

http://g4ac.co.za/fu7WJ [ http://g4ac.co.za/1CHFX [ http://g4ac.co.za/kHuLH [
You can''t connect to a sql file across a network by default, you can only connect to a sql instance across a network.

http://g4ac.co.za/fu7WJ[^]

http://g4ac.co.za/1CHFX[^]

http://g4ac.co.za/kHuLH[^]


这篇关于连接到共享文件夹中的sql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆