All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
SQL,Server,数据库连接字符串的声明_[SQL,Server教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/2/1 0:11:13 Browse times: 434 Comment times: 0

SQL,Server,数据库连接字符串的声明_[SQL,Server教程]


Head photo

Go homepage
Upload pictures
Write articles

SQL Server 数据库连接字符串的声明_[SQL Server教程]

连接字符串中常用的声明有:
服务器声明 Data Source、Server和Addr等。
数据库声明 Initial Catalog和DataBase等。
集成Windows账号的安全性声明 Integrated Security和Trusted_Connection等。
使用数据库账号的安全性声明 User ID和Password等。

对于访问数据库的账号来说,通常我们在一些参考资料上看到ADO.NET的字符串连接往往有如下写法:
string ConnStr = "server = localhost; user id = sa; password = xxx; database = northwind";

对于集成Windows安全性的账号来说,其连接字符串写法一般如下:
string ConnStr = "server = localhost; integrated security = sspi; database = northwind";
或string ConnStr = "server = localhost; trusted_connection = yes; database = northwind";

使用Windows集成的安全性验证在访问数据库时具有很多优势:安全性更高、访问速度更快、减少重新设计安全架构的工作、可以硬编码连接字符串等,还是很值得使用的。

来源:网络





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.