Interface ValidConnection


  • public interface ValidConnection
    This interface allows JDBC applications to easily and quickly determine the usability of a java.sql.Connection object and to identify connection objects that should no longer be used for connection pooling.

    The isValid() method can be used for checking a connection or used in combination with a retry mechanism, such as one in response to Fast Connection Failover handling.

    The setInvalid() method is used to identify connections that are no longer suitable to be used in connection pooling. Once setInvalid() is called on a connection, the connection will not be returned to the pool instance upon close() but will instead be physically closed and removed from the pool instance.

    • Method Detail

      • isValid

        boolean isValid()
                 throws java.sql.SQLException
        Indicates whether this connection is usable.

        This can be used for general checking purpose on a connection, or used in combination with a retry mechanism, such as one in response to Fast Connection Failover handling.

        Returns:
        A boolean indicating whether this connection is usable. true if so; otherwise, false.
        Throws:
        java.sql.SQLException - If an error occurs.
      • setInvalid

        void setInvalid()
                 throws java.sql.SQLException
        Indicates that this connection is no longer valid for use.

        This method is used to identify connections that are no longer suitable to be used in connection pooling. Once it has been called on a connection, the connection is not returned to the pool instance upon close() but is instead physically closed and removed from the pool instance.

        Throws:
        java.sql.SQLException - If an error occurs.