io.vertx.sqlclient

## Interface SqlConnection

- All Superinterfaces:
    SqlClient
  All Known Subinterfaces:
    DB2Connection, MySQLConnection, PgConnection

      public interface SqlConnection
      extends SqlClient

  A connection to database server.
  Author:
    Julien Viet, Emad Alblueshi

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Transaction` | `begin()` Begin a transaction and returns a `Transaction` for controlling and tracking this transaction.
    `void` | `close()` Close the current connection after all the pending commands have been processed.
    `SqlConnection` | `closeHandler(Handler<Void> handler)` Set an handler called when the connection is closed.
    `DatabaseMetadata` | `databaseMetadata()`
    `SqlConnection` | `exceptionHandler(Handler<Throwable> handler)` Set an handler called with connection errors.
    `boolean` | `isSSL()`
    `SqlConnection` | `prepare(String sql, Handler<AsyncResult<PreparedStatement>> handler)` Create a prepared query.

    - ### Methods inherited from interface io.vertx.sqlclient.SqlClient

      `preparedQuery, query`

- - ### Method Detail

    - #### prepare

          SqlConnection prepare(String sql,
                                Handler<AsyncResult<PreparedStatement>> handler)

      Create a prepared query.
      Parameters:
        `sql` - the sql
        `handler` - the handler notified with the prepared query asynchronously

    - #### exceptionHandler

          SqlConnection exceptionHandler(Handler<Throwable> handler)

      Set an handler called with connection errors.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### closeHandler

          SqlConnection closeHandler(Handler<Void> handler)

      Set an handler called when the connection is closed.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### begin

          Transaction begin()

      Begin a transaction and returns a `Transaction` for controlling and tracking this transaction.

      When the connection is explicitely closed, any inflight transaction is rollbacked.
      Returns:
        the transaction instance

    - #### isSSL

          boolean isSSL()

      Returns:
        whether the connection uses SSL

    - #### close

          void close()

      Close the current connection after all the pending commands have been processed.
      Specified by:
        `close` in interface `SqlClient`

    - #### databaseMetadata

          DatabaseMetadata databaseMetadata()

      Returns:
        The static metadata about the backend database server for this connection

Copyright © 2021 Eclipse. All rights reserved.