连接数据库字符串 connectionString

来源:互联网 发布:ubuntu tftp 程序 编辑:程序博客网 时间:2024/05/17 05:53

<!--SQL Server2005-->
<add name="conn" connectionString="Server=.;Database=mydb;Uid=sa;Pwd=sa" />
<add name="conn" connectionString="Data Source=.;Database=mydb;User Id=sa;Password=pack; />
<add name="conn" connectionString="Data Source=.;Initial Catalog=mydb;User ID=sa;Password=pack" providerName="System.Data.SqlClient" />
<add name="conn" connectionString="Data Source=.;Initial Catalog=mydb;Integrated Security=True" providerName="System.Data.SqlClient" />

<!--Oracle 链接字符串-->
<add name="conn" connectionString="Data Source=mis;User ID=pack;Password=pack;Persist Security Info=false;Unicode=True" providerName="System.Data.OracleClient"/>

<!--
Data Source- 或 -Server- 或 -Address- 或 -Addr- 或 -Network Address 要连接的 SQL Server 实例的名称或网络地址。

Initial Catalog- 或 -Database        数据库的名称。

Integrated Security- 或 -Trusted_Connection   
当为 false 时,将在连接中指定用户 ID 和密码。
当为 true 时,将使用当前的 Windows 帐户凭据进行身份验证。
可识别的值为 true、false、yes、no 以及与 true 等效的 sspi(强烈推荐)。

Password-或-Pwd       
SQL Server 帐户登录的密码(建议不要使用。为了维护最高级别的安全性,强烈建议改用 Integrated Security 或 Trusted_Connection 关键字)。

Persist Security Info
当该值设置为 false 或 no(强烈推荐)时,如果连接是打开的或者一直处于打开状态,那么安全敏感信息(如密码)将不会作为连接的一部分返回。
重置连接字符串将重置包括密码在内的所有连接字符串值。可识别的值为 true、false、yes 和 no。

User ID-或-Uid   
SQL Server 登录帐户(建议不要使用。为了维护最高级别的安全性,强烈建议改用 Integrated Security 或 Trusted_Connection 关键字)。

-->