欢迎使用CSDN-markdown编辑器

来源:互联网 发布:编程和数学的联系 编辑:程序博客网 时间:2024/06/05 19:35

MS SQL Server 连接字符串

字符串:

1、Data Source=.;uid=sa;pwd=wzb0227;Integrated Security=SSPI;Initial Catalog=Evaluation;Integrated Security=True

2、Data Source=(local);Initial Catalog=BarefootIndex0425;User Id=sa;Password=sa;Connect Timeout=180;Enlist=true;Pooling=true;Max Pool Size = 300;Min Pool Size = 5;Connection Lifetime=200;packet size=4096

其中:

[Data Source]:别名(Server、Address、Addr),如果是本地数据库且定义了实例名,则可以写为”Server=(local)\实例名”;如果是远程服务器,则将”(local)”替换为远程服务器的名称或IP地址。

[Initial Catalog]:别名(Database)

[user id]:别名(uid)

[Password]:别名(pwd)

[Connect Timeout]:连接超时时间为30秒.

[Enlist]

[Pooling]

[Max Pool Size]

[Min Pool Size]

[Connection Lifetime]

[packet size]

[Integrated Security]??

[Trusted_Connection]Windows登录,如果你的SQL Server设置为Windows登录,那么在这里就不需要使用”user id”和”password”这样的方式来登录,

而需要使用”Trusted_Connection=SSPI”来进行登录.

Integrated Security=SSPI与Trusted_Connection=SSPI的区别?

0 0
原创粉丝点击