Top Fields Constructors Methods
org.apache.derby.impl.jdbc

public Class EmbedXAConnection

extends EmbedPooledConnection
implements XAConnection
Class Inheritance
All Implemented Interfaces
javax.sql.XAConnection, javax.sql.PooledConnection
Imports
org.apache.derby.impl.jdbc.Util, org.apache.derby.iapi.jdbc.BrokeredConnectionControl, .EmbeddedDataSourceInterface, .EmbeddedXADataSourceInterface, .EngineConnection, .ResourceAdapter, org.apache.derby.shared.common.reference.SQLState, java.sql.Connection, .ResultSet, .SQLException, .Statement, .PreparedStatement, .CallableStatement, javax.transaction.xa.XAResource, javax.sql.XAConnection

Field Summary

Modifier and TypeField and Description
private EmbedXAResource
Inherited from org.apache.derby.impl.jdbc.EmbedPooledConnection:
currentConnectionHandledataSourcedefaultIsolationLevelisActiverealConnection

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
checkAutoCommit(boolean
New auto commit setting
autoCommit
)

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkAutoCommit.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkAutoCommit.

Allow control over setting auto commit mode.

public void
public void
public int
checkHoldCursors(int
Current holdability
holdability
,
boolean
true to downgrade the holdability, false to throw an exception.
downgrade
)

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkHoldCursors.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkHoldCursors.

Are held cursors allowed.

public void
public void
public Connection
getConnection()

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.getConnection.

Implements javax.sql.PooledConnection.getConnection.

Creates and returns a Connection object that is a handle for the physical connection that this PooledConnection object represents.

public EngineConnection
getRealConnection()

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.getRealConnection.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.getRealConnection.

Override getRealConnection to create a a local connection when we are not associated with an XA transaction.

public final synchronized XAResource
getXAResource()

Implements javax.sql.XAConnection.getXAResource.

Retrieves an XAResource object that the transaction manager will use to manage this XAConnection object's participation in a distributed transaction.

private boolean

Returns:

true if the transaction is global, false if the transaction is local
isGlobal
()

Check if this connection is part of a global XA transaction.

public boolean
public Statement
public PreparedStatement
wrapStatement(PreparedStatement
PreparedStatment to be wrapped
ps
,
String
String
sql
,
Object
Object
generatedKeys
)

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

Wrap and control a PreparedStatement

public CallableStatement
Inherited from org.apache.derby.impl.jdbc.EmbedPooledConnection:
addConnectionEventListeneraddStatementEventListenercheckActivecloseclosingConnectiongetLanguageConnectiongetNewCurrentConnectionHandlegetPasswordgetUsernameisActiveisIsolationLevelSetUsingSQLorJDBCnotifyErrornotifyExceptiononStatementCloseonStatementErrorOccurredopenRealConnectionremoveConnectionEventListenerremoveStatementEventListenerresetIsolationLevelFlagresetRealConnectiontoString

Field Detail

xaResback to summary
private EmbedXAResource xaRes

Constructor Detail

EmbedXAConnectionback to summary
public EmbedXAConnection(EmbeddedDataSourceInterface ds, ResourceAdapter ra, String u, String p, boolean requestPassword) throws SQLException

Method Detail

checkAutoCommitback to summary
public void checkAutoCommit(boolean autoCommit) throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkAutoCommit.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkAutoCommit.

Allow control over setting auto commit mode.

Parameters
autoCommit:boolean

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkAutoCommit.

New auto commit setting

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkAutoCommit.

on error

checkCloseback to summary
public void checkClose() throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkClose.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkClose.

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkClose.

Check if the brokered connection can be closed.

Exceptions
SQLException:
if it is not allowed to call close on the brokered connection
See Also
org.apache.derby.iapi.jdbc.BrokeredConnectionControl#checkClose()
checkCommitback to summary
public void checkCommit() throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkCommit.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkCommit.

Allow control over calling commit.

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkCommit.

on error

checkHoldCursorsback to summary
public int checkHoldCursors(int holdability, boolean downgrade) throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkHoldCursors.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkHoldCursors.

Are held cursors allowed. If the connection is attached to a global transaction then downgrade the result set holdabilty to CLOSE_CURSORS_AT_COMMIT if downgrade is true, otherwise throw an exception. If the connection is in a local transaction then the passed in holdabilty is returned.

Parameters
holdability:int

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkHoldCursors.

Current holdability

downgrade:boolean

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkHoldCursors.

true to downgrade the holdability, false to throw an exception.

Returns:int

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkHoldCursors.

whether cursors can be held across commits

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkHoldCursors.

on error

checkRollbackback to summary
public void checkRollback() throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkRollback.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkRollback.

Allow control over calling rollback.

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkRollback.

on error

checkSavepointback to summary
public void checkSavepoint() throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.checkSavepoint.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkSavepoint.

Allow control over creating a Savepoint (JDBC 3.0)

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.checkSavepoint.

on error

getConnectionback to summary
public Connection getConnection() throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.getConnection.

Implements javax.sql.PooledConnection.getConnection.

Doc from javax.sql.PooledConnection.getConnection.

Creates and returns a Connection object that is a handle for the physical connection that this PooledConnection object represents. The connection pool manager calls this method when an application has called the method DataSource.getConnection and there are no PooledConnection objects available. See the interface description for more information.

Returns:Connection

a Connection object that is a handle to this PooledConnection object

Exceptions
SQLException:
if a database access error occurs
getRealConnectionback to summary
public EngineConnection getRealConnection() throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.getRealConnection.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.getRealConnection.

Override getRealConnection to create a a local connection when we are not associated with an XA transaction. This can occur if the application has a Connection object (conn) and the following sequence occurs. conn = xac.getConnection(); xac.start(xid, ...) // do work with conn xac.end(xid, ...); // do local work with conn // need to create new connection here.

Returns:EngineConnection

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.getRealConnection.

the real JDBC connection

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.getRealConnection.

on error

getXAResourceback to summary
public final synchronized XAResource getXAResource() throws SQLException

Implements javax.sql.XAConnection.getXAResource.

Doc from javax.sql.XAConnection.getXAResource.

Retrieves an XAResource object that the transaction manager will use to manage this XAConnection object's participation in a distributed transaction.

Returns:XAResource

the XAResource object

Exceptions
SQLException:
if a database access error occurs
isGlobalback to summary
private boolean isGlobal()

Check if this connection is part of a global XA transaction.

Returns:boolean

true if the transaction is global, false if the transaction is local

isInGlobalTransactionback to summary
public boolean isInGlobalTransaction()

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.isInGlobalTransaction.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.isInGlobalTransaction.

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.isInGlobalTransaction.

Is this a global transaction

Returns:boolean

true if this is a global XA transaction

See Also
BrokeredConnectionControl#isInGlobalTransaction()
wrapStatementback to summary
public Statement wrapStatement(Statement s) throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

Wrap and control a Statement

Parameters
s:Statement

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

The original statement

Returns:Statement

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

a wrapper statement

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

on error

wrapStatementback to summary
public PreparedStatement wrapStatement(PreparedStatement ps, String sql, Object generatedKeys) throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

Wrap and control a PreparedStatement

Parameters
ps:PreparedStatement

Doc from org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

PreparedStatment to be wrapped

sql:String

Doc from org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

String

generatedKeys:Object

Doc from org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

Object

Returns:PreparedStatement

Doc from org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

returns the wrapped PreparedStatement

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

on error

wrapStatementback to summary
public CallableStatement wrapStatement(CallableStatement cs, String sql) throws SQLException

Overrides org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

Implements org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

Wrap and control a PreparedStatement

Parameters
cs:CallableStatement

Doc from org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

CallableStatment to be wrapped

sql:String

Doc from org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

String

Returns:CallableStatement

Doc from org.apache.derby.impl.jdbc.EmbedPooledConnection.wrapStatement.

returns the wrapped CallableStatement

Exceptions
SQLException:

Doc from org.apache.derby.iapi.jdbc.BrokeredConnectionControl.wrapStatement.

on error