See SqlConnection.ConnectionString for more information about the Type System Version keyword. The Type System Version keyword in a SqlConnection.ConnectionString specifies the client-side representation of SQL Server types. The DataSource property of a SqlConnection object is read-only. You can also set the DataSource property of the SqlConnectionStringBuilder to the instance name when building a connection string. To connect to a named instance of SQL Server, use the server name\instance name syntax. Connect to a named instance of SQL Server
If you specify both Integrated Security=true as well as a user name and password, the user name and password will be ignored and Windows authentication will be used. Windows authentication takes precedence over SQL Server logins. When you connect to Azure SQL Database or to Azure SQL Data Warehouse and provide a login in the format make sure that the servername value in the login matches the value provided for Server=. "Persist Security Info=False User ID=***** Password=***** Initial Catalog=AdventureWorks Server=MySqlServer" In this example, asterisks are used to represent a valid user name and password. However, if SQL Server Authentication is required, use the following syntax to specify a user name and password. Windows Authentication is preferred for connecting to SQL Server.
"Persist Security Info=False Trusted_Connection=True "Persist Security Info=False Integrated Security=SSPI Initial Catalog=AdventureWorks Server=MSSQL1" "Persist Security Info=False Integrated Security=true Windows authentication with SqlClientĮach of the following forms of syntax uses Windows Authentication to connect to the AdventureWorks database on a local server. Keep Persist Security Info set to false to ensure that an untrusted source does not have access to sensitive connection string information. Setting it to true or yes allows security-sensitive information, including the user ID and password, to be obtained from the connection after the connection has been opened. The default setting for the Persist Security Info keyword is false. Integrated Security=true - or - Integrated Security=SSPI The following table shows the Windows Authentication syntax used with the. The syntax employed in the connection string varies by provider. We recommend using Windows Authentication (sometimes referred to as integrated security) to connect to data sources that support it. For more information, see Connection String Builders. The connection string builders allow you to construct syntactically valid connection strings at run time, so you do not have to manually concatenate connection string values in your code. For more information on connection string syntax, see ConnectionString.ĪDO.NET 2.0 introduced the following connection string builders for the. Provides data access for Oracle version 8.1.7 or later. For more information on connection string syntax, see ConnectionString. Provides data access for data sources exposed using ODBC.
Provides data access for data sources exposed using OLE DB. Provides data access for Microsoft SQL Server. NET Framework.NET Framework data provider The following table lists the four data providers that are included in the. The specific connection string syntax for each provider is documented in its ConnectionString property. NET Framework data provider has a Connection object that inherits from DbConnection as well as a provider-specific ConnectionString property.