SQL Server 連接字符串的一些聲明
以下的文章主要向大家講述的是SQL Server 連接字符串的一些聲明,其中包括,服務(wù)器聲明 Data Source、Server與Addr等,數(shù)據(jù)庫聲明, Initial Catalog與DataBase等,以下就是文章的主要內(nèi)容描述。
集成Windows賬號的安全性聲明 Integrated Security和Trusted_Connection等。
使用數(shù)據(jù)庫賬號的安全性聲明 User ID和Password等。
對于訪問數(shù)據(jù)庫的賬號來說,通常我們在一些參考資料上看到ADO.NET的字符串連接往往有如下寫法:
- string ConnStr = "server = localhost;
- user id = sa; password = xxx; database = northwind";
對于集成Windows安全性的賬號來說,其SQL Server 連接字符串寫法一般如下:
- string ConnStr = "server = localhost;
- integrated security = sspi; database = northwind";
或
- string ConnStr = "server = localhost;
- trusted_connection = yes; database = northwind";
使用Windows集成的安全性驗證在訪問數(shù)據(jù)庫時具有很多優(yōu)勢:安全性更高、訪問速度更快、減少重新設(shè)計安全架構(gòu)的工作、可以硬編碼SQL Server 連接字符串等,還是很值得使用的。
上述的相關(guān)內(nèi)容就是對SQL Server 連接字符串的聲明的描述,希望會給你帶來一些幫助在此方面。
原文標題:SQL Server 連接字符串的聲明
連接:http://www.cnblogs.com/msikruby/archive/2009/12/14/1623649.html
【編輯推薦】