public class FBConnection extends java.lang.Object implements FirebirdConnection, Synchronizable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<java.sql.Statement> |
activeStatements |
protected FBManagedConnection |
mc |
protected InternalTransactionCoordinator |
txCoordinator |
TPB_CONCURRENCY, TPB_CONSISTENCY, TPB_NO_REC_VERSION, TPB_NOWAIT, TPB_READ, TPB_READ_COMMITTED, TPB_REC_VERSION, TPB_WAIT, TPB_WRITE| Constructor and Description |
|---|
FBConnection(FBManagedConnection mc)
Create a new AbstractConnection instance based on a
FBManagedConnection. |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(java.util.concurrent.Executor executor) |
void |
addWarning(java.sql.SQLWarning warning) |
protected void |
checkClientInfoSupport()
Checks if client info is supported.
|
protected void |
checkValidity()
Check if this connection is valid.
|
void |
clearWarnings() |
void |
close() |
void |
commit() |
java.sql.Array |
createArrayOf(java.lang.String typeName,
java.lang.Object[] elements) |
java.sql.Blob |
createBlob() |
java.sql.Clob |
createClob() |
java.sql.NClob |
createNClob() |
java.sql.SQLXML |
createSQLXML() |
java.sql.Statement |
createStatement() |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency) |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
java.sql.Struct |
createStruct(java.lang.String typeName,
java.lang.Object[] attributes) |
TransactionParameterBuffer |
createTransactionParameterBuffer()
Create new instance of
TransactionParameterBuffer. |
protected void |
finalize() |
protected void |
freeStatements()
This method closes all active statements and cleans resources.
|
boolean |
getAutoCommit() |
java.lang.String |
getCatalog() |
java.util.Properties |
getClientInfo() |
protected java.lang.String |
getClientInfo(java.sql.PreparedStatement stmt,
java.lang.String name) |
java.lang.String |
getClientInfo(java.lang.String name) |
DatabaseParameterBuffer |
getDatabaseParameterBuffer()
Get database parameter buffer for this connection.
|
protected FBEscapedParser |
getEscapedParser()
Returns the FBEscapedParser instance for this connection.
|
FbDatabase |
getFbDatabase()
Provides access to the low-level connection handle.
|
GDSHelper |
getGDSHelper() |
int |
getHoldability() |
java.lang.String |
getIscEncoding()
Get current ISC encoding.
|
FirebirdLocalTransaction |
getLocalTransaction()
Returns a FBLocalTransaction instance that enables a component to
demarcate resource manager local transactions on this connection.
|
FBManagedConnection |
getManagedConnection() |
java.sql.DatabaseMetaData |
getMetaData() |
int |
getNetworkTimeout() |
java.lang.String |
getSchema() |
FBObjectListener.StatementListener |
getStatementListener() |
java.lang.Object |
getSynchronizationObject()
Get synchronization object.
|
int |
getTransactionIsolation() |
TransactionParameterBuffer |
getTransactionParameters(int isolationLevel)
Get transaction parameters for the specified transaction isolation level.
|
java.util.Map<java.lang.String,java.lang.Class<?>> |
getTypeMap() |
java.sql.SQLWarning |
getWarnings() |
boolean |
inTransaction()
Check if this connection is currently involved in a transaction
|
protected void |
invalidateSavepoints()
Invalidate all savepoints.
|
protected void |
invalidateTransactionLifetimeObjects()
Invalidate everything that should only last for the lifetime of the current transaction.
|
boolean |
isClosed() |
boolean |
isReadOnly() |
boolean |
isUseFirebirdAutoCommit() |
boolean |
isValid(int timeout) |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
java.lang.String |
nativeSQL(java.lang.String sql) |
java.sql.CallableStatement |
prepareCall(java.lang.String sql) |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
protected java.sql.PreparedStatement |
prepareMetaDataStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
protected java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability,
boolean metaData,
boolean generatedKeys) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames) |
void |
releaseSavepoint(java.sql.Savepoint savepoint) |
void |
rollback() |
void |
rollback(java.sql.Savepoint savepoint) |
void |
setAutoCommit(boolean autoCommit) |
void |
setCatalog(java.lang.String catalog) |
protected void |
setClientInfo(java.sql.PreparedStatement stmt,
java.lang.String name,
java.lang.String value) |
void |
setClientInfo(java.util.Properties properties) |
void |
setClientInfo(java.lang.String name,
java.lang.String value) |
void |
setHoldability(int holdability) |
void |
setManagedConnection(FBManagedConnection mc)
Set the
FBManagedConnection around which this connection is
based. |
void |
setManagedEnvironment(boolean managedConnection) |
void |
setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds) |
void |
setReadOnly(boolean readOnly) |
java.sql.Savepoint |
setSavepoint() |
java.sql.Savepoint |
setSavepoint(java.lang.String name)
Creates a named savepoint.
|
void |
setSchema(java.lang.String schema) |
protected void |
setTransactionCoordinator(boolean managedConnection,
boolean autoCommit) |
void |
setTransactionIsolation(int level) |
void |
setTransactionParameters(int isolationLevel,
int[] parameters)
Deprecated.
|
void |
setTransactionParameters(int isolationLevel,
TransactionParameterBuffer tpb)
Set transaction parameters for the specified transaction isolation level.
|
void |
setTransactionParameters(TransactionParameterBuffer tpb)
Set transaction parameters for the next transactions.
|
void |
setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map) |
<T> T |
unwrap(java.lang.Class<T> iface) |
protected FBManagedConnection mc
protected final InternalTransactionCoordinator txCoordinator
protected final java.util.Set<java.sql.Statement> activeStatements
public FBConnection(FBManagedConnection mc)
FBManagedConnection.mc - A FBManagedConnection around which this connection is basedpublic FBObjectListener.StatementListener getStatementListener()
public int getHoldability()
throws java.sql.SQLException
getHoldability in interface java.sql.Connectionjava.sql.SQLExceptionpublic void setHoldability(int holdability)
throws java.sql.SQLException
setHoldability in interface java.sql.Connectionjava.sql.SQLExceptionprotected void checkValidity()
throws java.sql.SQLException
java.sql.SQLException - if this connection has been closed and cannot be
used anymore.protected void freeStatements()
throws java.sql.SQLException
java.sql.SQLException - if at least one of the active statements failed
to close gracefully.public void setManagedConnection(FBManagedConnection mc)
FBManagedConnection around which this connection is
based.mc - The FBManagedConnection around which this connection is basedpublic FBManagedConnection getManagedConnection()
public FbDatabase getFbDatabase() throws java.sql.SQLException
FirebirdConnectionWARNING using this connection handle directly may bring the JDBC connection in an inconsistent state.
getFbDatabase in interface FirebirdConnectionjava.sql.SQLExceptionpublic DatabaseParameterBuffer getDatabaseParameterBuffer()
DatabaseParameterBuffer.@Deprecated
public void setTransactionParameters(int isolationLevel,
int[] parameters)
throws java.sql.SQLException
FirebirdConnectionsetTransactionParameters in interface FirebirdConnectionisolationLevel - JDBC isolation level.parameters - array of TPB parameters, see all TPB_* constants.java.sql.SQLException - if specified transaction parameters cannot be set.public TransactionParameterBuffer getTransactionParameters(int isolationLevel) throws java.sql.SQLException
FirebirdConnectiongetTransactionParameters in interface FirebirdConnectionisolationLevel - isolation level defined in the Connection
interface.TransactionParameterBuffer containing current
transaction parameters.java.sql.SQLException - if error occured obtaining transaction parameters.public TransactionParameterBuffer createTransactionParameterBuffer() throws java.sql.SQLException
FirebirdConnectionTransactionParameterBuffer.createTransactionParameterBuffer in interface FirebirdConnectionTransactionParameterBuffer.java.sql.SQLException - if error occured during this operation.public void setTransactionParameters(int isolationLevel,
TransactionParameterBuffer tpb)
throws java.sql.SQLException
FirebirdConnectionsetTransactionParameters in interface FirebirdConnectionisolationLevel - isolation level defined in the Connection
interface.tpb - instance of TransactionParameterBuffer with parameters
to set.java.sql.SQLException - if error occured during this operation.public void setTransactionParameters(TransactionParameterBuffer tpb) throws java.sql.SQLException
FirebirdConnectionConnection.setTransactionIsolation(int)
is called.
Method cannot be called when transaction has already started.
setTransactionParameters in interface FirebirdConnectiontpb - instance of TransactionParameterBuffer with new
transaction parameters.java.sql.SQLException - if method is called within a transaction.public java.sql.Statement createStatement()
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Blob createBlob()
throws java.sql.SQLException
FirebirdConnectioncreateBlob in interface java.sql.ConnectioncreateBlob in interface FirebirdConnectionFirebirdBlob.java.sql.SQLExceptionpublic java.sql.Clob createClob()
throws java.sql.SQLException
createClob in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Struct createStruct(java.lang.String typeName,
java.lang.Object[] attributes)
throws java.sql.SQLException
createStruct in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Array createArrayOf(java.lang.String typeName,
java.lang.Object[] elements)
throws java.sql.SQLException
createArrayOf in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String nativeSQL(java.lang.String sql)
throws java.sql.SQLException
nativeSQL in interface java.sql.Connectionjava.sql.SQLExceptionprotected FBEscapedParser getEscapedParser()
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
setAutoCommit in interface java.sql.Connectionjava.sql.SQLExceptionprotected void setTransactionCoordinator(boolean managedConnection,
boolean autoCommit)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void setManagedEnvironment(boolean managedConnection)
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean getAutoCommit()
throws java.sql.SQLException
getAutoCommit in interface java.sql.Connectionjava.sql.SQLExceptionpublic void commit()
throws java.sql.SQLException
commit in interface java.sql.Connectionjava.sql.SQLExceptionpublic void rollback()
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLExceptionprotected void invalidateTransactionLifetimeObjects()
public void close()
throws java.sql.SQLException
Implementation note: Certain fatal errors also result in a closed Connection.
close in interface java.lang.AutoCloseableclose in interface java.sql.Connectionjava.sql.SQLExceptionpublic boolean isClosed()
isClosed in interface java.sql.Connectionpublic boolean isValid(int timeout)
throws java.sql.SQLException
isValid in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.Connectionjava.sql.SQLExceptionpublic void setReadOnly(boolean readOnly)
throws java.sql.SQLException
setReadOnly in interface java.sql.Connectionjava.sql.SQLExceptionpublic boolean isReadOnly()
throws java.sql.SQLException
isReadOnly in interface java.sql.Connectionjava.sql.SQLExceptionpublic void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
Implementation ignores calls to this method as catalogs are not supported.
setCatalog in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String getCatalog()
throws java.sql.SQLException
getCatalog in interface java.sql.Connectionnull as catalogs are not supported.java.sql.SQLExceptionpublic void setTransactionIsolation(int level)
throws java.sql.SQLException
setTransactionIsolation in interface java.sql.Connectionjava.sql.SQLExceptionpublic int getTransactionIsolation()
throws java.sql.SQLException
getTransactionIsolation in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
getWarnings in interface java.sql.Connectionjava.sql.SQLExceptionpublic void clearWarnings()
throws java.sql.SQLException
clearWarnings in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionprotected java.sql.PreparedStatement prepareMetaDataStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionprotected java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability,
boolean metaData,
boolean generatedKeys)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()
throws java.sql.SQLException
getTypeMap in interface java.sql.Connectionjava.sql.SQLExceptionpublic void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
throws java.sql.SQLException
setTypeMap in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Savepoint setSavepoint()
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.Savepoint setSavepoint(java.lang.String name)
throws java.sql.SQLException
Savepoint names need to be valid Firebird identifiers, and the maximum length is restricted to the maximum
identifier length (see DatabaseMetaData.getMaxColumnNameLength(). The implementation will take care of
quoting the savepoint name appropriately for the connection dialect. The name should be passed unquoted.
With connection dialect 1, the name is restricted to the rules for unquoted identifier names, that is, its
characters are restricted to A-Za-z0-9$_ and handled case insensitive.
For dialect 2 and 3, the name is restricted to the rules for Firebird quoted identifiers (essentially any printable character and space is valid), and the name is handled case sensitive.
setSavepoint in interface java.sql.Connectionname - Savepoint namejava.sql.SQLException - if a database access error occurs, this method is called while participating in a distributed
transaction, this method is called on a closed connection or this Connection object is currently
in auto-commit modepublic void rollback(java.sql.Savepoint savepoint)
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLExceptionpublic void releaseSavepoint(java.sql.Savepoint savepoint)
throws java.sql.SQLException
releaseSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionprotected void invalidateSavepoints()
public FirebirdLocalTransaction getLocalTransaction()
public boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic void setSchema(java.lang.String schema)
throws java.sql.SQLException
Implementation ignores calls to this method as schemas are not supported.
setSchema in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String getSchema()
throws java.sql.SQLException
getSchema in interface java.sql.Connectionnull as schemas ar not supportedjava.sql.SQLExceptionpublic boolean inTransaction()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String getIscEncoding()
throws java.sql.SQLException
FirebirdConnectiongetIscEncoding in interface FirebirdConnectionjava.sql.SQLExceptionpublic void addWarning(java.sql.SQLWarning warning)
public java.sql.NClob createNClob()
throws java.sql.SQLException
Implementation note: This method behaves exactly the same as createClob().
createNClob in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.sql.SQLXML createSQLXML()
throws java.sql.SQLException
createSQLXML in interface java.sql.Connectionjava.sql.SQLExceptionpublic GDSHelper getGDSHelper() throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean isUseFirebirdAutoCommit()
isUseFirebirdAutoCommit in interface FirebirdConnectiontrue if this connection is configured to use isc_tpb_autocommit when in auto commit.protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwableprotected void checkClientInfoSupport()
throws java.sql.SQLException
java.sql.SQLException - If the client info is not supported, or if there is no database connection.public java.util.Properties getClientInfo()
throws java.sql.SQLException
getClientInfo in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.lang.String getClientInfo(java.lang.String name)
throws java.sql.SQLException
getClientInfo in interface java.sql.Connectionjava.sql.SQLExceptionprotected java.lang.String getClientInfo(java.sql.PreparedStatement stmt,
java.lang.String name)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void setClientInfo(java.util.Properties properties)
throws java.sql.SQLClientInfoException
setClientInfo in interface java.sql.Connectionjava.sql.SQLClientInfoExceptionpublic void setClientInfo(java.lang.String name,
java.lang.String value)
throws java.sql.SQLClientInfoException
setClientInfo in interface java.sql.Connectionjava.sql.SQLClientInfoExceptionprotected void setClientInfo(java.sql.PreparedStatement stmt,
java.lang.String name,
java.lang.String value)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void abort(java.util.concurrent.Executor executor)
throws java.sql.SQLException
abort in interface java.sql.Connectionjava.sql.SQLExceptionpublic void setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds)
throws java.sql.SQLException
setNetworkTimeout in interface java.sql.Connectionjava.sql.SQLExceptionpublic int getNetworkTimeout()
throws java.sql.SQLException
getNetworkTimeout in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.lang.Object getSynchronizationObject()
SynchronizablegetSynchronizationObject in interface Synchronizablenull.Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.