今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个

Failover Partner的选项。以前都没注意过,它的主要功能就是在使用DB Mirror时,让应用程序可以自己在principal和secondary之间,选择一个可用的连接,不用再手动切换了。以前还真没注意过个连接配置。例如连接字符串为:

Data Source=DataBaseStr1;Failover Partner=DataBaseStr2;Initial Catalog=MirrorTestDB;User ID=sa;Password=sa

那么程序会自动连接DataBaseStr1,当DataBaseStr1这个数据库Fail Over时,就自动选择连接 DataBaseStr2。

这个选项在2005时特别有用,但是要注意,在2008中,FailOver这个选项已经没用了。因为2008已经具备自动检测的功能了,在2008中,直接写成:Data Source=DataBaseStr1;Initial Catalog=MirrorTestDB;User ID=sa;Password=sa就可以了,当DataBaseStr1 FailOver时,数据库会自动为你切换的

下面列出了msdn中关于数据库连接字符串的具体使用方法,以作备份。

Keyword

Default

Description

Application Name

N/A

The name of the application, or '.NET SQLClient Data Provider' if no application name is provided.

Async

'false'

When true, enables asynchronous operation support. Recognized values are true, false, yes, and no.

AttachDBFilename

-or-

extended properties

-or-

Initial File Name

N/A

The name of the primary database file, including the full path name of an attachable database. AttachDBFilename is only supported for primary data files with an .mdf extension.

The p_w_upload will fail if the primary data file is read-only.

The path may be absolute or relative by using the DataDirectory substitution string. If DataDirectory is used, the database file must exist within a subdirectory of the directory pointed to by the substitution string.

Note:

Remote server, HTTP, and UNC path names are not supported.

The database name must be specified with the keyword 'database' (or one of its aliases) as in the following:

"AttachDbFileName=|DataDirectory|/data/YourDB.mdf;integrated security=true;database=YourDatabase"

An error will be generated if a log file exists in the same directory as the data file and the 'database' keyword is used when attaching the primary data file. In this case, remove the log file. Once the database is attached, a new log file will be automatically generated based on the physical path.

Connect Timeout

-or-

Connection Timeout

15

The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.

Context Connection

'false'

true if an in-process connection to SQL Server should be made.

Current Language

N/A

The SQL Server Language record name.

Data Source

-or-

Server

-or-

Address

-or-

Addr

-or-

Network Address

N/A

The name or network address of the instance of SQL Server to which to connect. The port number can be specified after the server name:

server=tcp:servername, portnumber

When specifying a local instance, always use (local). To force a protocol, add one of the following prefixes:

np:(local), tcp:(local), lpc:(local)

Note:

ADO.NET 2.0 does not support asynchronous commands over shared memory for SQL Server 2000 or earlier. However, you can force the use of TCP instead of shared memory, either by prefixing tcp: to the server name in the connection string, or by using localhost.

Encrypt

'false'

When true, SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed. Recognized values are true, false, yes, and no.

Enlist

'false'

true indicates that the SQL Server connection pooler automatically enlists the connection in the creation thread's current transaction context.

Failover Partner

N/A

The name of the failover partner server where database mirroring is configured.

The Failover Partner keyword is not supported by .NET Framework version 1.0 or 1.1.

Initial Catalog

-or-

Database

N/A

The name of the database.

Integrated Security

-or-

Trusted_Connection

'false'

When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication.

Recognized values are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true.

MultipleActiveResultSets

'false'

When true, an application can maintain multiple active result sets (MARS). When false, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.

Recognized values are true and false.

The keyword is not supported by .NET Framework version 1.0 or 1.1.

Network Library

-or-

Net

'dbmssocn'

The network library used to establish a connection to an instance of SQL Server. Supported values include dbnmpntw (Named Pipes), dbmsrpcn (Multiprotocol), dbmsadsn (Apple Talk), dbmsgnet (VIA), dbmslpcn (Shared Memory) and dbmsspxn (IPX/SPX), and dbmssocn (TCP/IP).

The corresponding network DLL must be installed on the system to which you connect. If you do not specify a network and you use a local server (for example, "." or "(local)"), shared memory is used.

Packet Size

8192

Size in bytes of the network packets used to communicate with an instance of SQL Server.

Password

-or-

Pwd

N/A

The password for the SQL Server account logging on. Not recommended. To maintain a high level of security, we strongly recommend that you use the Integrated Security orTrusted_Connection keyword instead.

Persist Security Info

'false'

When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values including the password. Recognized values are true, false, yes, and no.

Replication

'false'

true if replication is supported using the connection.

Transaction Binding

Implicit Unbind

Controls connection association with an enlistedSystem.Transactions transaction.

Possible values are:

Transaction Binding=Implicit Unbind;

Transaction Binding=Explicit Unbind;

Implicit Unbind causes the connection to detach from the transaction when it ends. After detaching, additional requests on the connection are performed in autocommit mode. TheSystem.Transactions.Transaction.Current property is not checked when executing requests while the transaction is active. After the transaction has ended, additional requests are performed in autocommit mode.

Explicit Unbind causes the connection to remain attached to the transaction until the connection is closed or an explicitSqlConnection.TransactionEnlist(null) is called. AnInvalidOperationException is thrown if Transaction.Current is not the enlisted transaction or if the enlisted transaction is not active.

TrustServerCertificate

'false'

When set to true, SSL is used to encrypt the channel when bypassing walking the certificate chain to validate trust. If TrustServerCertificate is set to true and Encrypt is set to false, the channel is not encrypted. Recognized values are true, false,yes, and no. For more information, see "Encryption Hierarchy" and "Using Encryption Without Validation" in SQL Server 2005 Books Online.

Type System Version

N/A

A string value that indicates the type system the application expects. Possible values are:

Type System Version=SQL Server 2000;

Type System Version=SQL Server 2005;

Type System Version=SQL Server 2008;

Type System Version=Latest;

When set to SQL Server 2000, the SQL Server 2000 type system is used. The following conversions are performed when connecting to a SQL Server 2005 instance:

XML to NTEXT

UDT to VARBINARY

VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) to TEXT, NEXT and IMAGE respectively.

When set to SQL Server 2005, the SQL Server 2005 type system is used. No conversions are made for the current version of ADO.NET.

When set to Latest, the latest version than this client-server pair can handle is used. This will automatically move forward as the client and server components are upgraded.

User ID

N/A

The SQL Server login account. Not recommended. To maintain a high level of security, we strongly recommend that you use the Integrated Security or Trusted_Connection keywords instead.

User Instance

'false'

A value that indicates whether to redirect the connection from the default SQL Server Express instance to a runtime-initiated instance running under the account of the caller.

Workstation ID

The local computer name

The name of the workstation connecting to SQL Server.

Name

Default

Description

Connection Lifetime

0

When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by Connection Lifetime. This is useful in clustered configurations to force load balancing between a running server and a server just brought online.

A value of zero (0) causes pooled connections to have the maximum connection timeout.

Connection Reset

'true'

Determines whether the database connection is reset when being drawn from the pool. For SQL Server version 7.0, setting to false avoids making an additional server round trip when obtaining a connection, but you must realize that the connection state, such as database context, is not being reset.

The connection pooler is not influenced by the ChangeDatabase method as long you do not set Connection Reset to false. As the connection comes out of the pool the connection is reset with the server moving back to the login time database. There are no new connections created or reauthentications. If you setConnection Reset to false, connections in the pool to different databases might result.

Enlist

'true'

When true, the pooler automatically enlists the connection in the creation thread's current transaction context. Recognized values are true, false, yes, andno.

Load Balance Timeout

0

The minimum time, in seconds, for the connection to live in the connection pool before being destroyed.

Max Pool Size

100

The maximum number of connections allowed in the pool.

Min Pool Size

0

The minimum number of connections allowed in the pool.

Pooling

'true'

When true, the SQLConnection object is drawn from the appropriate pool, or if it is required, is created and added to the appropriate pool. Recognized values are true, false, yes, and no.

转载于:https://blog.51cto.com/3353175/1075395

今天在webcasts上看sql server 2008的新功能介绍,无意中发现在连接sql server 数据库时,还有一个...相关推荐

  1. 微软Windows Server 2008认证体系详细介绍

    微软Windows Server 2008认证体系详细介绍 微软在6月14日的MCP LiveMeeting上正式公布了Windows Server 2008认证路线图.备受关注的微软新一代服务器操作 ...

  2. SQL 2014新功能介绍系列3 - 备份还原篇

    大数据催生了云计算和移动互联的世界.微软新的战略方针"cloud first,mobilefirst"也表明公司正在全面转向云计算中转型.在最新发布的SQLServer 2014与 ...

  3. Server 2012 Hyper-v新功能之二:自动化支持技术

    Server 2012 Hyper-v新功能之一:客户端 Hyper-V Windows PowerShell 是在 Windows Server 中执行自动化任务的脚本解决方案,新的适用于 Wind ...

  4. java access 密码_java 连接加密Access2007数据库时,不用输入用户名密码也能连上

    java 连接加密Access2007数据库时,不用输入用户名密码也能连上 我用Access2007做了一个加密的数据库,用的是Access本身的功能加密的.双击打开Database2.mdb文件时, ...

  5. 微软服务器sql server,解析:微软SQL Server 2008特性和功能

    导语:SQL Server 2008系统诞生于08年3月13日,在微软2008新一代企业应用平台与开发技术发布大会上,微软宣布向企业用户大众同时发布三款核心应用平台产品:Windows Server ...

  6. windows server 2008 oracle 10g,一次不太愉快的Windows Server 2008 R2 SP1上安装ORACLE 10G经历...

    华为服务器型号RH5885 V3,安装windows server 2008 r2, oracle 10g 1.安装包要使用10204_vista_w2k8_x64_production_db.zip ...

  7. SQL Server 2008 R2 新特性之一

    2008年8月6日,微软发布了SQL Server 2008正式版,时至今日,大部分企业还在使用SQL Server 2000和2005. SQL Server 2008 中还是增加了不少新特性的 , ...

  8. SQL Server 2016的新功能–动态数据屏蔽

    There are many new features in SQL Server 2016, but the one we will focus on in this post is: SQL Se ...

  9. SQL Server 2016的新功能–临时数据表

    There are many new features in SQL Server 2016, but the one we will focus on in this post is: SQL Se ...

最新文章

  1. 设计模式---设计模式的分类及六大原则
  2. 根据作用C语言关键字分为,C语言 关键字
  3. 你必须要懂的APK瘦身知识
  4. 删除microsoft_如何从您的Microsoft帐户中删除设备
  5. 江苏省计算机等级知识,江苏省计算机二级考试基础知识_计算机基础练习题
  6. 一条SQL语句的千回百转
  7. scrapy配合selenium爬取需要反复操作同一个动态页面的方法,解决点击“下一页”但是URL相同的网站
  8. MediaPlayer控件的初探
  9. hdu 1231最大连续子序列 动态规划
  10. java多线程计算pi_Java多线程——计算1-20阶乘和
  11. ue4使用Niagara粒子实现下雨效果,使用蓝图调节雨量
  12. 应用程序无法正常启动0xc000007b解决方法
  13. 数据分析中的数据处理以及特征分析
  14. “/Ox”和“/RTC1”命令行选项不兼容 或者 ml.exe 退出
  15. 如何将废旧显示器改造为家用电视机
  16. selenium使用webdriver自动化浏览器打不开无法输入网址
  17. 微信聊天记录服务器端口是什么意思,微信端口异常是什么意思?
  18. 【软考】系统集成项目管理工程师(三)系统集成专业技术知识
  19. Xib与Nib区别联系
  20. 呆在家睡觉,倒不如在家学习

热门文章

  1. 设计模式与设计原则 —— 一句话
  2. 最简单的git merge 和git rebase 介绍和示例演示
  3. CD(Continuous Deployment)实战问题之unable to read askpass解决
  4. Javascript 给页面元素添加事件函数探讨
  5. 创建数据库链接(dblink)步骤
  6. dbexception.java,mysql – org.h2.jdbc.JdbcSQLException:找不到列“ID”
  7. 文件在IDEA中已进行Git的Commit操作,使其从暂存区提交到本地仓库,但是未Push到远程仓库,此时进行Pull操作出现代码冲突
  8. html左侧隐藏菜单栏,如何制作一个炫酷的隐藏侧边栏菜单
  9. 数据预处理包括哪些内容python_常见的数据预处理--python篇
  10. python入门程序异常_Python 入门 之 异常处理