IConnection.IsValid(Int32) 方法

定义

如果连接尚未关闭且仍然有效,则返回 true。

[Android.Runtime.Register("isValid", "(I)Z", "GetIsValid_IHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public bool IsValid(int timeout);
[<Android.Runtime.Register("isValid", "(I)Z", "GetIsValid_IHandler:Java.Sql.IConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member IsValid : int -> bool

参数

timeout
Int32
  •         The time in seconds to wait for the database operation
                                                       used to validate the connection to complete.  If
                                                       the timeout period expires before the operation
                                                       completes, this method returns false.  A value of
                                                       0 indicates a timeout is not applied to the
                                                       database operation.
          &lt;p&gt;
    

返回

如果连接有效,则为 true;否则为 false

属性

例外

如果 timeout

注解

如果连接尚未关闭且仍然有效,则返回 true。 驱动程序应在连接上提交查询,或使用一些其他机制来积极验证连接在调用此方法时仍然有效。

驱动程序提交的用于验证连接的查询应在当前事务的上下文中执行。

在 1.6 <p> 中添加。

Java文档java.sql.Connection.isValid(int)

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于