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集成的安全性驗證在訪問數據庫時具有很多優勢:安全性更高、訪問速度更快、減少重新設計安全架構的工作、可以硬編碼連接字符串等,還是很值得使用的
服務器聲明 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集成的安全性驗證在訪問數據庫時具有很多優勢:安全性更高、訪問速度更快、減少重新設計安全架構的工作、可以硬編碼連接字符串等,還是很值得使用的
轉載于:https://www.cnblogs.com/zxlin25/archive/2009/03/11/1408824.html
總結
以上是生活随笔為你收集整理的SQL Server 数据库连接字符串的声明的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 周五:IPC连接及远程执行
- 下一篇: [发布]Quartz.NET 示例程序: