Interface FbAttachment

    • 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.
      • forceClose

        void forceClose()
                 throws java.sql.SQLException
        Forces the connection to close without proper detach or cleanup.

        If a given implementation does not support this, then this method should call close().

        Throws:
        java.sql.SQLException - For problems closing the connection.
      • 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.
      • setNetworkTimeout

        void setNetworkTimeout​(int milliseconds)
                        throws java.sql.SQLException
        Sets the network timeout for this attachment.
        Parameters:
        milliseconds - Timeout in milliseconds; 0 means no timeout. If the attachment doesn't support milliseconds, it should round up to the nearest second.
        Throws:
        java.sql.SQLException - If this attachment is closed, the value of milliseconds is smaller than 0, or if setting the timeout fails.
        java.sql.SQLFeatureNotSupportedException - If this attachment doesn't support (changing) the network timeout.
      • getNetworkTimeout

        int getNetworkTimeout()
                       throws java.sql.SQLException
        Gets the current network timeout for this attachment.
        Returns:
        Timeout in milliseconds, 0 means no timeout
        Throws:
        java.sql.SQLException - If this attachment is closed
        java.sql.SQLFeatureNotSupportedException - If this attachment doesn't support network timeout
      • withLock

        LockCloseable withLock()
        Locks the lock with Lock.lock() (or equivalent).

        The returned LockClosable can be used to unlock, preferably for use in a try-with-resources.

        Returns:
        lock closeable which unlocks the lock on close
      • isLockedByCurrentThread

        boolean isLockedByCurrentThread()
        Queries if the lock is held by the current thread.
        Returns:
        true if current thread holds this lock and false otherwise
        See Also:
        ReentrantLock.isHeldByCurrentThread()