SQL connection string configuration attributes

Source: Internet
Author: User
Tags failover

 

The configuration attributes of connection string are as follows:

The following content is taken from msdn:

 

The following table listsConnectionstringThe valid name of the keyword value in.

Keywords

Default Value

Description

ApplicationProgramName

N/

Application name, or ". Net sqlclient data provider" (if no application name is provided ).

Async

'False'

If it is setTrueTo enable asynchronous operations. The identifiable value isTrue,False,YesAndNo.

attachdbfilename

-or-

extended properties

-or-

initial file name

N/A

name of the master database file, including the complete path name that can be connected to the database. Only primary data files with. MDF Extensions support attachdbfilename.

If the primary data file is read-only, the additional operation fails.

the path can be an absolute or relative path, depending on whether the string is replaced by datadirectory. If datadirectory is used, the corresponding database file must exist in the subdirectory to which the replacement string points.

Note:

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

the database name must be specified using the keyword "Database" (or one of its aliases) as follows:

"attachdbfilename = | datadirectory | \ data \ yourdb. MDF; Integrated Security = true; database = yourdatabase "

If the log file exists in the directory where the data file is located, when the "Database" keyword is used to append the primary data file, an error is generated. In this case, remove the log file. After a database is attached, the system automatically generates a new log file based on the physical path.

Connect timeout

-Or-

Connection timeout

15

The duration (in seconds) of waiting for connection to the server before terminating the attempt and generating an error ).

Context connection

'False'

If the SQL server should be connected in-processTrue.

Current Language

N/

The name of the SQL Server language record.

Data Source

-Or-

Server

-Or-

Address

-Or-

ADDR

-Or-

Network Address

N/

The name or network address of the SQL server instance to connect. You can specify the port number after the server name:

Server = TCP: servername, portnumber

Always use (local) when specifying a local instance ). 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 command execution on SQL Server 2000 or a lower version of shared memory. However, you can force TCP to replace the shared memory by adding the "TCP:" prefix to the server name in the connection string or using "local host ".

Encrypt

'False'

When this value isTrueIf a certificate is installed on the server, SQL server uses SSL encryption for all data transmitted between the client and the server. The identifiable value isTrue,False,YesAndNo.

Enlist

'False'

TrueIndicates that the SQL server connection pool program automatically registers the connection in the context of the current transaction in which the thread is created.

Failover partner

N/

The name of the Failover partner server in which the database image is configured.

. NET Framework 1.0 or 1.1 does not support the Failover partner keyword.

Initial catalog

-Or-

Database

N/

The name of the database.

Integrated Security

-Or-

Trusted_connection

'False'

WhenFalseUser ID and password are specified in the connection. WhenTrueThe current Windows Account creden。 are used for authentication.

The identifiable value isTrue,False,Yes,NoAndTrueEquivalentSspi(Strongly recommended ).

multipleactiveresultsets

'false'

if it is true , the application can maintain multiple active result sets (MARS ). If it is false , the application must process or cancel multiple result sets in one batch before any other batch processing on the connection is executed.

the identifiable values are true and false .

. NET Framework 1.0 or 1.1 does not support this keyword.

Network Library

-Or-

Net

'Dbmssocn'

The network library used to establish a connection with the SQL server instance. Supported values include:

Dbnmpntw (Named Pipe)

Dbmsrpcn (multi-protocol, Windows RPC)

Dbmsadsn (Apple Talk)

Dbmsgnet ()

Dbmslpcn (shared memory)

Dbmsspxn (IPX/SPX)

Dbmssocn (TCP/IP)

Dbmsvinn (Banyan Vines)

The corresponding network dll must be installed on the system to be connected. If a local server (such as "." or "(local)") is used without specifying the network, the shared memory is used. In this example, the network library is Win32 Winsock TCP/IP (dbmssocn) and the port used is 1433.


Copy code
Network library = dbmssocn; Data Source = 000.000.000.000, 1433;

Packet Size

8192

The size of network data packets used to communicate with SQL Server instances, in bytes.

Password

-Or-

PWD

N/

The logon password of the SQL Server account. We recommend that you do not use it. We strongly recommend that you useIntegrated SecurityOrTrusted_connectionKeyword.

Persist Security info

'False'

When this value is setFalseOrNo(Strongly recommended), if the connection is opened or is always open, the security sensitive information (such as the password) will not be returned as part of the connection. Resetting the connection string resets all connection string values, including passwords. The identifiable value isTrue,False,YesAndNo.

Replication

'False'

If the connection is used to support replicationTrue.

transaction binding

implicit unbind

controls the connections associated with the registered system. Transactions transaction.

possible values include:

transaction binding = implicit unbind;

transaction binding = explicit unbind;

implicit unbind allows the connection to be separated from the service at the end of the transaction. After the splitting, other requests on the connection will be executed in the automatic submission mode. The system. transactions. transaction. current attribute. After the transaction ends, other requests are executed in the automatic commit mode.

explicit unbind allows the connection to remain connected to the transaction until the connection is closed or the explicit sqlconnection. transactionenlist (null) . If transaction. current is not a registered transaction or the registered transaction is not active, causing invalidoperationexception .

trustservercertificate

'false'

if it is set to true , SSL is used to encrypt the channel, however, the reliability is not verified through the certificate chain. If you set trustservercertificate to true and encrypt to false , the channel is not encrypted. The identifiable values include true , false , and Yes and NO . For more information, see connection string syntax (ADO. Net) .

type system version

N/A

indicates the string value of the type system that the application expects. Possible values include:

type system version = SQL Server 2000;

type system version = SQL Server 2005;

type system version = SQL Server 2008;

type system version = Latest;

if it is set to SQL Server 2000 , the SQL Server 2000 system is used. When you connect to an SQL Server 2005 instance, perform the following conversions:

XML to ntext

UDT to varbinary

varchar (max) and nvarchar (max) and varbinary (max) to text, next, and image respectively.

if it is set to SQL Server 2005 , the SQL Server 2005 system is used. The current version of ADO. NET is not converted.

if it is set to latest , the latest version cannot be processed by this client-server. The latest version is automatically updated with the upgrade of client and server components.

User ID

N/

SQL Server Logon account. We recommend that you do not use it. We strongly recommend that you useIntegrated SecurityOrTrusted_connectionKeyword.

User instance

'False'

A value that indicates whether to redirect the connection from the default SQL Server quick release instance to the running instance started under the caller account.

Workstation ID

Local Computer Name

The name of the workstation that connects to SQL Server.

The following table listsConnectionstringValid name of the value of the connection pool. For more information, seeSQL Server connection pool (ADO. Net).

Name

Default Value

Description

Connection lifetime

0

When the connection is returned to the pool, the creation time is compared with the current time. If the length of time (in seconds) exceedsConnection lifetimeThe connection is destroyed. This is useful in clustering configuration (used to force load balancing between running servers and servers that are just online ).

The zero (0) value will cause the maximum connection timeout for the pool connection.

Enlist

'True'

When this value isTrueThe pool program automatically registers the connection in the context of the current transaction that creates the thread. The identifiable value isTrue,False,YesAndNo.

Load Balance timeout

0

The shortest time (in seconds) before the connection pool is 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 this value isTrueThe system extracts data from the appropriate pool.SqlconnectionObject, or create the object as needed and add it to the appropriate pool. The identifiable value isTrue,False,YesAndNo.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.