Connection String parameters for MSSQL databases (.NET)

From RemObjects Wiki
Jump to: navigation, search

This is a Concept topic for Data Abstract for .NET


Connection string includes keyword/value pairs. All pairs are separated by a semicolon. Every keyword and its value are connected with the equal sign (=).

Keywords and values are not case sensitive.

The connection string should specify the Server and Database along with the necessary User ID and Password to access the database. The following connection string connects to the Northwind database on the Test\Dev1 server:

Server=Test\Dev1;Database=Northwind;User ID=sa;Password=;

The following table shows keyword values and their description for the connection string. Some of the keywords have several equivalents (alternative names).

Connection String parameters

Keyword
Default
Description
Addr N/A Alternative name of the keyword Data Source.
Address N/A Alternative name of the keyword Data Source.
Application Name N/A If no application name is provided, use '.NET SQLClient Data Provider'.
Async false Enables or disables asynchronous operation support.
AttachDBFilename 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.

Note that remote servers, HTTP, and UNC (\\server\sharename\folder\) path names are not supported.

The database name must be specified with the keyword 'database' (or one of its aliases) like this:

AttachDbFileName=|DataDirectory|\data\YourDB.mdf;integrated security=true;database=YourDatabase
Connect Timeout 15 The length of time (in seconds) to wait for a connection to the server.
Connection Timeout 15 Alternative name of the keyword Connect Timeout.
Context Connection false Use true if an in-process connection to a SQL Server should be made.
Current Language N/A The SQL Server Language record name.
Data Source N/A The name or network address of the instance of the SQL Server to which to connect.

The port number can be specified after the server name:

Server=tcp:servername, portnumber
Database N/A
Encrypt false Use true if the server has a certificate installed and if you want SQL Server to use SSL encryption for all data sent between the client and server.
Enlist false Signals whether the pooler automatically enlists the connection in the creation thread's current transaction context.
extended properties N/A Alternative name of the keyword AttachDBFilename.
Failover Partner N/A The name of the server where database mirroring is configured. This keyword is not supported by .NET Framework 1.0 or 1.1.

Use this property if you connect to a database that is being mirrored, so your application can take the advantage of the driver's ability to automatically redirect connections when a database mirroring failover occurs.

Initial Catalog N/A Alternative name of the keyword Database.
Initial File Name N/A Alternative name of the keyword AttachDBFilename.
Integrated Security false Alternative name of keyword Trusted_Connection.
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 another batch on that connection.
Net dbmssocn Alternative name of the keyword Network Library.
Network Address N/A Alternative name of the keyword Data Source.
Network Library dbmssocn Used to establish a connection to an instance of SQL Server. Supported values include dbnmpntw (Named Pipes), dbmsrpcn (Multiprotocol, Windows RPC), dbmsadsn (Apple Talk), dbmsgnet (VIA), dbmslpcn (Shared Memory), dbmsspxn (IPX/SPX), dbmssocn (TCP/IP), Dbmsvinn (Banyan Vines). The protocol's DLL must be installed to properly connect.
Packet Size 8192 In bytes.
Password N/A
Persist Security Info false Determines whether security information is available once a connection has been established. A true value makes security-sensitive data like the username and password available, whereas false denies it. Resetting the connection string resets all connection string values, including the password.
Pwd N/A Alternative name of the keyword Password.
Replication false
Server N/A Alternative name of the keyword Data Source.
Transaction Binding Implict Unbind Controls connection association with an enlisted System.Transactions transaction. Possible values are Implicit Unbind (causes the connection to detach from the transaction when it ends) and Explicit Unbind (causes the connection to remain attached to the transaction until the connection is closed or an explicit).
TrustServerCertificate false When true, SSL is used to encrypt the channel when bypassing walking the certificate chain to validate trust. Make sure that Encrypt is set to true for the channel to be encrypted.
Trusted_Connection false When false, User ID and Password are specified in the connection string. When true, the current Windows account credentials are used for authentication.
Type System Version N/A Indicates the system type the application expects. Possible values are "SQL Server 2000", "SQL Server 2005", "SQL Server 2008", "Latest" (the latest version that this client-server pair can handle; automatically moves forward as the client and server components are upgraded).
User ID N/A
User Instance false 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


See Also


Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Xcode, Delphi, Java and JavaScript

GlossaryArticlesFeaturesLibrarySamples

Personal tools
Namespaces

Variants
Actions
Navigation
products
platforms
special
Toolbox