org.firebirdsql.gds.ng

## Interface FbAttachment

- All Superinterfaces:
    java.lang.AutoCloseable, ExceptionListenable
  All Known Subinterfaces:
    FbDatabase, FbService, FbWireAttachment, FbWireDatabase, FbWireService, JnaAttachment
  All Known Implementing Classes:
    AbstractFbAttachment, AbstractFbDatabase, AbstractFbService, AbstractFbWireDatabase, AbstractFbWireService, JnaDatabase, JnaService, V10Database, V10Service, V11Database, V12Database, V13Database

      public interface FbAttachment
      extends java.lang.AutoCloseable, ExceptionListenable

  Connection to a Firebird server (to a database or service).

  All methods defined in this interface and the direct descendants `FbDatabase` and `FbService` are required to notify all `SQLException` thrown from the methods defined in this interface, and those exceptions notified by all `ExceptionListenable` implementations created from them.

  Since:
    3.0
  Author:
    Mark Rotteveel

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `attach()` Attach to the attachment type.
    `void` | `close()` Detaches and closes the connection.
    `DatatypeCoder` | `getDatatypeCoder()`
    `Encoding` | `getEncoding()`
    `IEncodingFactory` | `getEncodingFactory()`
    `int` | `getHandle()`
    `GDSServerVersion` | `getServerVersion()`
    `java.lang.Object` | `getSynchronizationObject()` Get synchronization object.
    `boolean` | `isAttached()` Current attachment status.

    - ### Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable

      `addExceptionListener, removeExceptionListener`

- - ### Method Detail

    - #### attach

          void attach()
                      throws java.sql.SQLException

      Attach to the attachment type.
      Throws:
        `java.sql.SQLException`

    - #### close

          void close()
                     throws java.sql.SQLException

      Detaches and closes the connection.
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Throws:
        `java.sql.SQLException` - If not currently connected, or another problem occurred detaching.

    - #### getHandle

          int getHandle()

      Returns:
        The attachment handle value

    - #### getServerVersion

          GDSServerVersion getServerVersion()

      Returns:
        Firebird version string

    - #### isAttached

          boolean isAttached()

      Current attachment status.
      Returns:
        `true` if connected to the server and attached to a database or service, `false` otherwise.

    - #### getSynchronizationObject

          java.lang.Object getSynchronizationObject()

      Get synchronization object.
      Returns:
        object, cannot be `null`.

    - #### getEncodingFactory

          IEncodingFactory getEncodingFactory()

      Returns:
        The `IEncodingFactory` for this connection

    - #### getEncoding

          Encoding getEncoding()

      Returns:
        The connection encoding (should be the same as returned from calling `IEncodingFactory.getDefaultEncoding()` on the result of `getEncodingFactory()`.

    - #### getDatatypeCoder

          DatatypeCoder getDatatypeCoder()

      Returns:
        The `DatatypeCoder` for this database implementation.

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.