VS. NET database interface: connection string, vs.net string

Source: Internet
Author: User

VS. NET database interface: connection string, vs.net string

The ADO. NET Class Library provides consistent access to different external data sources. These data sources can be local data files (such as excel, txt, access, SQLite), or remote database servers (such as SQL Server, MySQL, DB2, and Oracle ). ADO. NET has compiled different data providers for different data sources.

To access the correct data sourceConnection stringIt is a set of formatted key-value pairs: an element contains a key-value pair, separated. It tells the ADO. NET data source where it is located, what data format is needed, what access trust level is provided, and any other information including the connection.

Basic Syntax:Data Source + Database Name (Initial Catalog) + User ID + Password ).

Description of available options in the connection string

ApplicationName: the name of the application. If it is not specified, its value is. NETSqlClient Data Provider ).

AttachDBFileName/extendedproperties/Initial File Name: Name of the main File that can be connected to the database, including the full path Name. The database name must be specified with the keyword database.

ConnectTimeout (Connection Timeout)/Connection Timeout (Connection Timeout): the length of time (in seconds) for a Connection to the server to wait before termination. The default value is 15.

ConnectionLifetime: when a connection is returned to the connection pool, its creation time is compared with the current time. If the time span exceeds the validity period of the connection, the connection will be canceled. The default value is 0.

ConnectionReset: Indicates whether a connection is reset when it is removed from the connection pool. The missing value is true.

CurrentLanguage: the name of the SQL Server language record.

Data Source/Server/Address/Addr/Network Address: The name or Network Address of the SQL Server instance.

Encrypt (encryption): When the value is true, if an authorization certificate is installed on the Server, SQL Server uses SSL encryption for all data transmitted between the client and the Server. The accepted values include true, false, yes, and no ).

Enlist: indicates whether the connection pool program automatically registers the connection in the current transaction context of the Creation thread. The default value is true.

Database/Initial Catalog: name of the Database.

IntegratedSecurity (Integrated Security)/Trusted Connection (Trusted Connection): Indicates whether Windows authentication is used to connect to the database. It can be set to "true", "false", or "true-to-peer" sspi. Its default value is "false.

Max PoolSize: the maximum number of connections allowed by the connection pool. The default value is 100.

Min PoolSize: the minimum number of connections allowed by the connection pool. The default value is 0.

NetworkLibrary/Net: The network library used to establish a connection to an SQL Server instance. Supported values include dbnmpntw (Named Pipes), dbmsrpcn (Multiprotocol/RPC), dbmsvinn (Banyan Vines), dbmsspxn (IPX/SPX), and dbmssocn (TCP/IP ). The dynamic Connection Library of the Protocol must be installed to an appropriate connection. The default value is TCP/IP.

Packet Size: the Size of the network Packet used to communicate with the database. The default value is 8192.

Password/Pwd: Password corresponding to the account name.

PersistSecurity Info: used to determine whether security information is available after a connection is established. If the value is true, sensitive data such as the user name and password is available, and false data is unavailable. Resetting the connection string will reconfigure the values of all connection strings, including passwords. The default value is false.

Pooling: determines whether to use the connection pool. If the value is true, the connection will be obtained from the appropriate connection pool, or, if necessary, the connection will be created and then added to the appropriate connection pool. The default value is true.

User ID: the account name used to log on to the database.

WorkstationID: the name of the workstation connected to SQL Server. The default value is the name of the local computer.

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.