sqlServer数据库常用连接字符串
sqlServer 数据库常用连接字符串
用户名和密码验证的方式去连接到数据库服务器
<add name="conStr" connectionString="Data Source=服务器名;Initial Catalog=数据库名; User Id=用户名;Password=密码"/>
<add name="conStr" connectionString="Server=服务器名;Database=数据库名;User Id=用户名;Password=密码"/>
<add name="conStr" connectionString="server=l服务器名;database=数据库名;uid=用户名;pwd=密码;pooling=true;min pool size=1;max pool size=2;connection reset=true"/>
Windows验证的方式去连接到数据库服务器
<add name="conStr" connectionString="Data Source=服务器名;Initial Catalog=数据库名;Integrated Security=True;" />
<add name="conStr" connectionString="Data Source=服务器名;Initial Catalog=数据库名;Integrated Security=SSPI;" />
<add name="conStr" connectionString="Data Source=服务器名;Initial Catalog=数据库名;Trusted_Connection = False;Encrypt = yes" />
<add name="conStr" connectionString=" data source=服务器名;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"/>
常用的属性:
服务器
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
sqlServer数据库常用连接字符串的更多相关文章
- C# 连接SQL数据库 常用连接字符串
一:C# 连接SQL数据库 Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myP ...
- SharePoint服务器将连接配置数据库的连接字符串保存在什么地方?
经常有人问我这个问题,SharePoint服务器将连接配置数据库的连接字符串保存在什么地方?虽然其他SharePoint服务器场设置都是保存到了配置数据库里面,但连接配置数据库本身的连接字符串,肯定是 ...
- SQLServer数据库之连接查询
SQLServer数据库之连接查询 表的连接查询的几种方法介绍: inner join on内连接,left join on 左连接 , rigth join on 右连接, full join on ...
- ASP.net分别连接SQLserver数据库与连接Access数据库精英版
-------------------------连接access2003 字符串------------------------- Provider=Microsoft.Jet.OLEDB.4.0; ...
- 操作sqlserver数据库常用的三个方法
1. ADO.NET -> 连接字符串,常用的两种方式: server=计算机名或ip\实例名;database=数据库名;uid=sa;pwd=密码; server=计算机名或ip\实例名;d ...
- ADO.NET连接字符串大全---各种数据库的连接字符串
ADO.NET连接字符串大全 ADO.NET连接字符串 名称 ADO.NET连接字符串 说明 ADO.NET连接字符串:SQL Server,SQL Server 2005,ACCESS,Oracle ...
- 【.Net MVC4 connectionString设置】获取SQL server数据库的连接字符串
第一步:创建向导文件 在桌面创建一个txt文件,并将文件后缀改成“.udl”. 第二步:选择“提供程序”tab页 双击新创建的“.udl”文件,进入后选择“提供程序”tab页,选择“Micros ...
- C#连接Oracle数据库的连接字符串
来源:http://blog.csdn.net/superhoy/article/details/8108037 两种方式:1.IP+SID方式 2.配置链接方式 1..IP+SID方式 DbHelp ...
- python常用连接字符串
1.使用占位符% print(('%s%s%s' % ('one','two', 'three'))) 2.'+'号连接 字符串是不可变对象,每次改变会申请一块新的内存,操作符+连接字符串的时候会涉及 ...
随机推荐
- Future设计模式
一.什么是Future模型: Future模式是多线程开发中非常常见的一种设计模式,它的核心思想是异步调用.这类似我们网上订餐订座,只要一个电话,客服就告诉我们已经预定成功(实际客服MM啥都还没做好) ...
- php5.3 php-fpm 开启 关闭 重启
自php5.3开始,php源码中包含了php-fpm,不需要单独通过补丁的方式安装php-fpm,在源码安装的时候直接 configure 中增加参数 –enable-fpm 即可. 所以启动.关 ...
- Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this scrip
在运行phpize时出现的错误 > /data/php/bin/phpize Configuring for: PHP Api Version: 20131106 Zend Module Api ...
- struts框架总结
1.struts2框架开发的过程:先导包,再写配置(写struts.xml配置,还有在web.xml中进行过滤器的配置,过滤器的配置一定不能少) 2.struts框架是前端web层的框架.主要的特点: ...
- NPOI导入导出Excel数据
代码: using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; using System; usi ...
- EXP-00056:遇到oracle错误12154
执行命令如下: 引用 exp user/pwd@dbname file=d:text.dmp owner=(user) 碰到了错误: 引用 EXP-00056:遇到oracle错误12154 ORA- ...
- Linux ld命令
一.简介 http://blog.sina.com.cn/s/blog_a0dc7dcf01014c5s.html 二.选项 http://blog.sina.com.cn/s/blog_a0dc7d ...
- 嵌入式的SQL程序设计
嵌入式的SQL程序设计 sql语句大全之嵌入式SQL 2017-01-18 16:00 来源:未知 嵌入式SQL 为了更好的理解嵌入式SQL,本节利用一个具体例子来说明.嵌入式SQL允许程序连接数 ...
- OSGi 系列(十二)之 Http Service
OSGi 系列(十二)之 Http Service 1. 原始的 HttpService (1) 新建 web-osgi 工程,目录结构如下: (2) HomeServlet package com. ...
- 2.自己搭建的一个简易的ioc容器
1.persondao类namespace MyselfIoC{ public class PersonDao { public override string ToStri ...