OracleConnection.ConnectionTimeout 属性

定义

获取在建立连接时终止尝试并生成错误之前所等待的时间。Gets the time to wait to establish a connection before terminating the attempt and generating an error.

public:
 virtual property int ConnectionTimeout { int get(); };
[System.ComponentModel.Browsable(false)]
public override int ConnectionTimeout { get; }
member this.ConnectionTimeout : int
Public Overrides ReadOnly Property ConnectionTimeout As Integer

属性值

等待连接打开所需的时间(以秒为单位)。The time (in seconds) to wait for a connection to open. 默认值为 15 秒。The default value is 15 seconds.

属性

异常

指定的值小于 0。The value specified is less than 0.

注解

可以使用连接字符串中的 Connect TimeoutConnection Timeout 关键字设置连接等待超时的时间。You can set the amount of time a connection waits to time out by using the Connect Timeout or Connection Timeout keywords in the connection string. 值0表示没有限制,应避免在 ConnectionString 中,因为尝试无限期地等待连接。A value of 0 indicates no limit, and should be avoided in a ConnectionString because an attempt to connect waits indefinitely.

备注

与其他 .NET Framework 数据提供程序(SQL Server、OLE DB 和 ODBC)中 Connection 对象不同的是,OracleConnection 不支持 ConnectionTimeout 属性。Unlike the Connection object in the other .NET Framework data providers (SQL Server, OLE DB, and ODBC), OracleConnection does not support a ConnectionTimeout property. 使用属性或在连接字符串中设置连接超时值无效,返回的值始终为零。Setting a connection time-out either with a property or in the connection string has no effect, and the value returned is always zero. OracleConnection 还不支持 Database 属性或 ChangeDatabase 方法。OracleConnection also does not support a Database property or a ChangeDatabase method.

适用于