.net oracle连接字符串,连接字符串语法

连接字符串语法Connection String Syntax

05/22/2018

本文内容

每个 .NET Framework 数据提供程序都有一个继承自 Connection 的 DbConnection 对象,以及一个提供程序特定的 ConnectionString 属性。Each .NET Framework data provider has a Connection object that inherits from DbConnection as well as a provider-specific ConnectionString property. 每个提供程序的特定连接字符串语法记录在其 ConnectionString 属性中。The specific connection string syntax for each provider is documented in its ConnectionString property. 下表列出了 .NET Framework 中包含的四个数据提供程序。The following table lists the four data providers that are included in the .NET Framework.

.NET Framework data provider — .NET Framework 数据提供程序.NET Framework data provider

描述Description

提供 Microsoft SQL Server 的数据访问。Provides data access for Microsoft SQL Server. 有关连接字符串语法的更多信息,请参见 ConnectionString。For more information on connection string syntax, see ConnectionString.

提供对使用 OLE DB 公开的数据源中的数据的访问。Provides data access for data sources exposed using OLE DB. 有关连接字符串语法的更多信息,请参见 ConnectionString。For more information on connection string syntax, see ConnectionString.

提供对使用 ODBC 公开的数据源中数据的访问。Provides data access for data sources exposed using ODBC. 有关连接字符串语法的更多信息,请参见 ConnectionString。For more information on connection string syntax, see ConnectionString.

提供对 Oracle 8.1.7 或更高版本中数据的访问。Provides data access for Oracle version 8.1.7 or later. 有关连接字符串语法的更多信息,请参见 ConnectionString。For more information on connection string syntax, see ConnectionString.

连接字符串生成器Connection String Builders

ADO.NET 2.0 为 .NET Framework 数据提供程序引入了以下连接字符串生成器。ADO.NET 2.0 introduced the following connection string builders for the .NET Framework data providers.

连接字符串生成器使你可以在运行时构造具有有效语法的连接字符串,从而不必在代码中手动串联连接字符串值。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, see Connection String Builders.

Windows 身份验证Windows Authentication

建议使用 Windows 身份验证 (有时称为 集成安全性) 连接到支持它的数据源。We recommend using Windows Authentication (sometimes referred to as integrated security) to connect to data sources that support it. 连接字符串中使用的语法根据提供程序的不同而不同。The syntax employed in the connection string varies by provider. 下表演示用于 .NET Framework 数据提供程序的 Windows 身份验证语法。The following table shows the Windows Authentication syntax used with the .NET Framework data providers.

提供程序Provider

语法Syntax

SqlClient

Integrated Security=true;

-- or --

Integrated Security=SSPI;

OleDb

Integrated Security=SSPI;

Odbc

Trusted_Connection=yes;

OracleClient

Integrated Security=yes;

备注

Integrated Security=true 用于 OleDb 提供程序时会引发异常。Integrated Security=true throws an exception when used with the OleDb provider.

SqlClient 连接字符串SqlClient Connection Strings

The syntax for a SqlConnection connection string is documented in the SqlConnection.ConnectionString property. 您可以使用 ConnectionString 属性来获取或设置 SQL Server 数据库的连接字符串。You can use the ConnectionString property to get or set a connection string for a SQL Server database. 如果您需要连接到早期版本的 SQL Server,则必须使用适用于 OleDb 的 .NET Framework 数据提供程序 (System.Data.OleDb)。If you need to connect to an earlier version of SQL Server, you must use the .NET Framework Data Provider for OleDb (System.Data.OleDb). Most connection string keywords als

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值