PoolableConnectionMXBean (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.tomcat.dbcp.dbcp2, interface: PoolableConnectionMXBean

# Interface PoolableConnectionMXBean

All Known Implementing Classes:
  `PoolableConnection, PoolableManagedConnection`

public interface PoolableConnectionMXBean
Defines the attributes and methods that will be exposed via JMX for `PoolableConnection` instances.

Since:
  2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearCachedState()`
  Clears the cached state.
  `void`
  `clearWarnings()`
  See `Connection.clearWarnings()`.
  `void`
  `close()`
  Returns this instance to my containing pool.
  `boolean`
  `getAutoCommit()`
  See `Connection.getAutoCommit()`.
  `boolean`
  `getCacheState()`
  Gets whether to cache properties.
  `String`
  `getCatalog()`
  See `Connection.getCatalog()`.
  `int`
  `getHoldability()`
  See `Connection.getHoldability()`.
  `String`
  `getSchema()`
  See `Connection.getSchema()`.
  `String`
  `getToString()`
  Gets the value of the `Object.toString()` method via a bean getter, so it can be read as a property via JMX.
  `int`
  `getTransactionIsolation()`
  See `Connection.getTransactionIsolation()`.
  `boolean`
  `isClosed()`
  See `Connection.isClosed()`.
  `boolean`
  `isReadOnly()`
  See `Connection.isReadOnly()`.
  `void`
  `reallyClose()`
  Closes the underlying `Connection`.
  `void`
  `setAutoCommit(boolean autoCommit)`
  See `Connection.setAutoCommit(boolean)`.
  `void`
  `setCacheState(boolean cacheState)`
  Sets whether to cache properties.
  `void`
  `setCatalog(String catalog)`
  See `Connection.setCatalog(String)`.
  `void`
  `setHoldability(int holdability)`
  See `Connection.setHoldability(int)`.
  `void`
  `setReadOnly(boolean readOnly)`
  See `Connection.setReadOnly(boolean)`.
  `void`
  `setSchema(String schema)`
  See `Connection.setSchema(String)`.
  `void`
  `setTransactionIsolation(int level)`
  See `Connection.setTransactionIsolation(int)`.

- ## Method Details

  - ### clearCachedState

    void clearCachedState()
    Clears the cached state. Call when you know that the underlying connection may have been accessed directly.

  - ### clearWarnings

    void clearWarnings() throws SQLException
    See `Connection.clearWarnings()`.
    Throws:
      `SQLException` - See `Connection.clearWarnings()`.

  - ### close

    void close() throws SQLException
    Returns this instance to my containing pool.
    Throws:
      `SQLException` - Throw if this instance cannot be returned.

  - ### getAutoCommit

    boolean getAutoCommit() throws SQLException
    See `Connection.getAutoCommit()`.
    Returns:
      See `Connection.getAutoCommit()`.
    Throws:
      `SQLException` - See `Connection.getAutoCommit()`.

  - ### getCacheState

    boolean getCacheState()
    Gets whether to cache properties. The cached properties are:
    - auto-commit
    - catalog
    - schema
    - read-only
    Returns:
      The value for the state caching flag.

  - ### getCatalog

    String getCatalog() throws SQLException
    See `Connection.getCatalog()`.
    Returns:
      See `Connection.getCatalog()`.
    Throws:
      `SQLException` - See `Connection.getCatalog()`.

  - ### getHoldability

    int getHoldability() throws SQLException
    See `Connection.getHoldability()`.
    Returns:
      See `Connection.getHoldability()`.
    Throws:
      `SQLException` - See `Connection.getHoldability()`.

  - ### getSchema

    String getSchema() throws SQLException
    See `Connection.getSchema()`.
    Returns:
      See `Connection.getSchema()`.
    Throws:
      `SQLException` - See `Connection.getSchema()`.

  - ### getToString

    String getToString()
    Gets the value of the `Object.toString()` method via a bean getter, so it can be read as a property via JMX.
    Returns:
      the value of the `Object.toString()`.

  - ### getTransactionIsolation

    int getTransactionIsolation() throws SQLException
    See `Connection.getTransactionIsolation()`.
    Returns:
      See `Connection.getTransactionIsolation()`.
    Throws:
      `SQLException` - See `Connection.getTransactionIsolation()`.

  - ### isClosed

    boolean isClosed() throws SQLException
    See `Connection.isClosed()`.
    Returns:
      See `Connection.isClosed()`.
    Throws:
      `SQLException` - See `Connection.isClosed()`.

  - ### isReadOnly

    boolean isReadOnly() throws SQLException
    See `Connection.isReadOnly()`.
    Returns:
      See `Connection.isReadOnly()`.
    Throws:
      `SQLException` - See `Connection.isReadOnly()`.

  - ### reallyClose

    void reallyClose() throws SQLException
    Closes the underlying `Connection`.
    Throws:
      `SQLException` - Thrown if the connection can be closed.

  - ### setAutoCommit

    void setAutoCommit(boolean autoCommit) throws SQLException
    See `Connection.setAutoCommit(boolean)`.
    Parameters:
      `autoCommit` - See `Connection.setAutoCommit(boolean)`.
    Throws:
      `SQLException` - See `Connection.setAutoCommit(boolean)`.

  - ### setCacheState

    void setCacheState(boolean cacheState)
    Sets whether to cache properties. The cached properties are:
    - auto-commit
    - catalog
    - schema
    - read-only
    Parameters:
      `cacheState` - The new value for the state caching flag

  - ### setCatalog

    void setCatalog(String catalog) throws SQLException
    See `Connection.setCatalog(String)`.
    Parameters:
      `catalog` - See `Connection.setCatalog(String)`.
    Throws:
      `SQLException` - See `Connection.setCatalog(String)`.

  - ### setHoldability

    void setHoldability(int holdability) throws SQLException
    See `Connection.setHoldability(int)`.
    Parameters:
      `holdability` - `Connection.setHoldability(int)`.
    Throws:
      `SQLException` - See `Connection.setHoldability(int)`.

  - ### setReadOnly

    void setReadOnly(boolean readOnly) throws SQLException
    See `Connection.setReadOnly(boolean)`.
    Parameters:
      `readOnly` - See `Connection.setReadOnly(boolean)`.
    Throws:
      `SQLException` - See `Connection.setReadOnly(boolean)`.

  - ### setSchema

    void setSchema(String schema) throws SQLException
    See `Connection.setSchema(String)`.
    Parameters:
      `schema` - See `Connection.setSchema(String)`.
    Throws:
      `SQLException` - See `Connection.setSchema(String)`.

  - ### setTransactionIsolation

    void setTransactionIsolation(int level) throws SQLException
    See `Connection.setTransactionIsolation(int)`.
    Parameters:
      `level` - See `Connection.setTransactionIsolation(int)`.
    Throws:
      `SQLException` - See `Connection.setTransactionIsolation(int)`.