sqlserver 数据库常用连接字符串 用户名和密码验证的方式去连接到数据库服务器 add name=constr connectionstring=data source=服务器名;initial catalog=数据库名; user id=用户名;password=密码/ add name=constr connectionstring=server=服务器名
sqlserver 数据库常用连接字符串
用户名和密码验证的方式去连接到数据库服务器
windows验证的方式去连接到数据库服务器
常用的属性:
服务器
data source
server
数据库
initial catalog
database
用户名
user id
uid
密码
password
pwd
启用连接池
pooling=true(默认值)
最小连接数量
min pool size=1;
最大连接数量
max pool size=2
重置连接池
connection reset=true
身份验证方式
integrated security
当为false时,将在连接中指定用户id和密码。
当为true时,将使用当前的windows帐户凭据进行身份验证。
可识别的值为true、false、yes、no以及与true等效的sspi。
信任连接
1)web.config中trusted_connection=true改为trusted_connection=false可以消除如下错误:
用户
'nt authority\network service' 登录失败。
(2)trusted_connection
当为 false 时,将在连接中指定用户 id 和密码。当为 true 时,将使用当前的 windows 帐户凭据进行身份验证。
可识别的值为 true、false、yes、no 以及与 true 等效的 sspi(强烈推荐)。
(3)当在web.config使用trusted_connection=true时,server database已设置为用信任连接了.
加密
encrypt = yes