public interface FbAttachment extends java.lang.AutoCloseable, ExceptionListenable
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.
Modifier and Type | Method and Description |
---|---|
void |
attach()
Attach to the attachment type.
|
void |
close()
Detaches and closes the connection.
|
void |
forceClose()
Forces the connection to close without proper detach or cleanup.
|
DatatypeCoder |
getDatatypeCoder() |
Encoding |
getEncoding() |
IEncodingFactory |
getEncodingFactory() |
int |
getHandle() |
int |
getNetworkTimeout()
Gets the current network timeout for this attachment.
|
GDSServerVersion |
getServerVersion() |
boolean |
isAttached()
Current attachment status.
|
boolean |
isLockedByCurrentThread()
Queries if the lock is held by the current thread.
|
void |
setNetworkTimeout(int milliseconds)
Sets the network timeout for this attachment.
|
LockCloseable |
withLock()
Locks the lock with
Lock.lock() (or equivalent). |
addExceptionListener, removeExceptionListener
void attach() throws java.sql.SQLException
java.sql.SQLException
void close() throws java.sql.SQLException
close
in interface java.lang.AutoCloseable
java.sql.SQLException
- If not currently connected, or another problem occurred detaching.void forceClose() throws java.sql.SQLException
If a given implementation does not support this, then this method should call close()
.
java.sql.SQLException
- For problems closing the connection.int getHandle()
GDSServerVersion getServerVersion()
boolean isAttached()
true
if connected to the server and attached to a database or service, false
otherwise.IEncodingFactory getEncodingFactory()
IEncodingFactory
for this connectionEncoding getEncoding()
IEncodingFactory.getDefaultEncoding()
on the result of getEncodingFactory()
).DatatypeCoder getDatatypeCoder()
DatatypeCoder
for this database implementation.void setNetworkTimeout(int milliseconds) throws java.sql.SQLException
milliseconds
- Timeout in milliseconds; 0 means no timeout. If the attachment doesn't support milliseconds, it should
round up to the nearest second.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.int getNetworkTimeout() throws java.sql.SQLException
java.sql.SQLException
- If this attachment is closedjava.sql.SQLFeatureNotSupportedException
- If this attachment doesn't support network timeoutLockCloseable withLock()
Lock.lock()
(or equivalent).
The returned LockClosable
can be used to unlock, preferably for use in a try-with-resources.
boolean isLockedByCurrentThread()
true
if current thread holds this lock and false
otherwiseReentrantLock.isHeldByCurrentThread()
Copyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.