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; }
[<System.ComponentModel.Browsable(false)>]
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 Timeout 连接字符串中的或关键字设置连接等待超时的时间 Connection 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.
备注
与 Connection 另一个 .NET Framework 数据访问接口中的对象 (SQL Server、OLE DB 和 ODBC) 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.