Package org.firebirdsql.gds.ng
Interface FbAttachment
- All Superinterfaces:
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,V15Database,V16Database
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
Modifier and TypeMethodDescriptionvoidattach()Attach to the attachment type.voidclose()Detaches and closes the connection.voidForces the connection to close without proper detach or cleanup.intintGets the current network timeout for this attachment.Get synchronization object.booleanCurrent attachment status.voidsetNetworkTimeout(int milliseconds) Sets the network timeout for this attachment.Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable
addExceptionListener, removeExceptionListener
-
Method Details
-
attach
Attach to the attachment type.- Throws:
SQLException
-
close
Detaches and closes the connection.- Specified by:
closein interfaceAutoCloseable- Throws:
SQLException- If not currently connected, or another problem occurred detaching.
-
forceClose
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:
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:
trueif connected to the server and attached to a database or service,falseotherwise.
-
getSynchronizationObject
Object getSynchronizationObject()Get synchronization object.- Returns:
- object, cannot be
null.
-
getEncodingFactory
IEncodingFactory getEncodingFactory()- Returns:
- The
IEncodingFactoryfor this connection
-
getEncoding
Encoding getEncoding()- Returns:
- The connection encoding (should be the same as returned from calling
IEncodingFactory.getDefaultEncoding()on the result ofgetEncodingFactory().
-
getDatatypeCoder
DatatypeCoder getDatatypeCoder()- Returns:
- The
DatatypeCoderfor this database implementation.
-
setNetworkTimeout
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:
SQLException- If this attachment is closed, the value ofmillisecondsis smaller than 0, or if setting the timeout fails.SQLFeatureNotSupportedException- If this attachment doesn't support (changing) the network timeout.
-
getNetworkTimeout
Gets the current network timeout for this attachment.- Returns:
- Timeout in milliseconds, 0 means no timeout
- Throws:
SQLException- If this attachment is closedSQLFeatureNotSupportedException- If this attachment doesn't support network timeout
-