我怎样才能找出这个连接字符串有什么问题?
我正在尝试运行 Nant 脚本来备份 Umbraco 实例< /a>.我需要更改的参数之一是使用 SQLOLEDB 提供程序的连接字符串。该脚本需要这个,因为它需要一个 .bak 文件并从新鲜状态恢复一个新数据库。
脚本中提到的需要调整的行是:
<property name="ole.db" value="Provider=SQLOLEDB;Data Source=localhost; Initial Catalog=master; Integrated Security=SSPI"/>
我正在运行 SQL Server 2008 Express,并且可以使用我的 Windows 登录名正常登录 Management Studio。我尝试将“localhost”更改为我的电脑名称,.\SQLEXPRESS 等,但当 Nant 脚本失败时,我不断收到以下错误:
System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
是权限问题还是在寻找错误的初始目录或其他内容?有没有办法快速调试/测试这种格式的连接字符串?
I'm trying to run a Nant script to backup an Umbraco instance. One of the parameters I need to change is a connection string using SQLOLEDB provider. The script needs this because it takes a .bak file and restores a new database from fresh.
The mentioned line in the script that needs to be tweaked is this:
<property name="ole.db" value="Provider=SQLOLEDB;Data Source=localhost; Initial Catalog=master; Integrated Security=SSPI"/>
I'm running SQL Server 2008 express and can log into management studio fine using my Windows login. I've tried changing "localhost" to my PC name, .\SQLEXPRESS etc but I keep getting the following error when the Nant script fails:
System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
Is it a permissions problem or is it looking for the wrong initial catalogue or something? Is there a way to quickly debug/test a connection string in this format?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要快速测试 Windows 盒子上的任何连接字符串,只需创建一个文本文件并将其扩展名从 .txt 更改为 .udl。
双击将打开数据源连接向导,您可以在其中选择所需的数据库驱动程序(在您的情况下为 SQL Server 的 OleDb)、服务器(在您的情况下为本地 SQL Express 实例)和数据库。
通过向导测试此连接后,您只需使用记事本打开 .udl 文件并复制连接字符串即可。
To quick-test any connection string on a windows box simply create a text file and change its extension from .txt to .udl.
Double-clicking will open the datasource connection wizard where you can select the desired database driver (OleDb for SQL Server in your case), the server (local SQL Express instance in your case) and the database.
After testing this connection from the wizard you can simply open your .udl file using notepad and copy the connection string.