连接字符串 - 无效的Connectionstring属性 [英] Connection String - Invalid Connectionstring attribute

查看:2413
本文介绍了连接字符串 - 无效的Connectionstring属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[SQL Server 2008 R2 Express]

我已经使用此连接字符串大约4年了,我将间歇性地收到错误消息:


-2147467259:Microsoft SQL Server Native Client 10.0

无效的连接字符串属性


" Provider = SQLNCLI10; Persist Security Info = True; OLE DB Services = -2; User ID = USERNAME; Password = PASSWORD; Initial Catalog = MYDB; Query Wait = -1; Data Source = WORK\MYINSTANCE"



与数据库的连接似乎工作正常(更新,选择,插入,所有工作仍然)。 我没有看到任何明显错误的东西。 我也不确定为什么这个CS有时会工作,而不是其他人。



我能看到的唯一两个可能的问题是查询等待和OLE DB服务= -2 < br $>


查询等待是默认值-1,但我将其设置为安全防范。不会认为这是一个问题。



我不知道为什么我将OLE DB设置为-2,如本网站所述,没有-2 ....所以我不确定这是否是我的问题的来源。

https://docs.microsoft.com/en-us/cpp/data/oledb/overriding-provider-service-defaults? view = vs-2019

我的理解是这是禁用连接池...

我们非常感谢任何建议或想法。




解决方案

< blockquote>

您好MrAvgProgrammer,


感谢您在此处发帖。


根据您的描述,我发现您使用的是提供商"SQLNCLI" ;(SQL Server Native Client OLE DB)。如您所知,SQL Server Native Client OLE DB(SQLNCLI)仍然不建议使用,因此不建议将其用于新的开发工作。
而是使用新的Microsoft OLE DB驱动程序用于SQL Server(MSOLEDBSQL),它将使用最新的服务器功能进行更新。


参考:


使用连接字符串关键字和SQL Server的OLE DB驱动程序


最好的问候,




[SQL Server 2008 R2 Express]
I have used this connection string for about 4 years now and I will intermittently receive an error message:

-2147467259 : Microsoft SQL Server Native Client 10.0
Invalid connection string attribute

"Provider=SQLNCLI10;Persist Security Info= True;OLE DB Services = -2;User ID=USERNAME;Password=PASSWORD;Initial Catalog=MYDB;Query Wait=-1;Data Source=WORK\MYINSTANCE"

The connection to the database seems to work fine (updates, selects, inserts, all work still).  I dont see anything that is obviously wrong.  I am also not sure why this CS works sometimes and not others.

The only 2 possible issues I could see is the Query Wait and OLE DB Services = -2

Query Wait is default -1, but I set it anyways as a safe guard. Wouldn't think that is an issue.

I am not sure why I have OLE DB set to -2, as noted on this site, there is no -2....So I am not quite certain if that is the source of my issue.
https://docs.microsoft.com/en-us/cpp/data/oledb/overriding-provider-service-defaults?view=vs-2019
My understanding is that this is Disabling connection pooling...
Any suggestions or ideas would greatly be appreciated.


解决方案

Hi MrAvgProgrammer,

Thanks for posting here.

Per your description, I see that you are using the Provider "SQLNCLI"(SQL Server Native Client OLE DB). As you know, the SQL Server Native Client OLE DB (SQLNCLI) remains deprecated and it is not recommended to use it for new development work. Instead, use the new Microsoft OLE DB Driver for SQL Server (MSOLEDBSQL) which will be updated with the most recent server features.

Reference:

Using Connection String Keywords with OLE DB Driver for SQL Server

Best Regards,

Will


这篇关于连接字符串 - 无效的Connectionstring属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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