javax.resource.cci
Interface Connection


public interface Connection

A Connection represents an application-level handle that is used by a client to access the underlying physical connection. The actual physical connection associated with a Connection instance is represented by a ManagedConnection instance.

A client gets a Connection instance by using the getConnection method on a ConnectionFactory instance. A connection can be associated with zero or more Interaction instances.

See Also:
ConnectionFactory, Interaction

Method Summary
 void close()
          Initiates close of the connection handle at the application level.
 Interaction createInteraction()
          Creates an Interaction associated with this Connection.
 boolean getAutoCommit()
          Gets the AutoCommit mode for the Connection.
 LocalTransaction getLocalTransaction()
          Returns an LocalTransaction instance that enables a component to demarcate resource manager local transactions on the Connection.
 ConnectionMetaData getMetaData()
          Gets the information on the underlying EIS instance represented through an active connection.
 ResultSetInfo getResultSetInfo()
          Gets the information on the ResultSet functionality supported by a connected EIS instance.
 void setAutoCommit(boolean autoCommit)
          Sets the AutoCommit mode for the Connection.
 

Method Detail

createInteraction

public Interaction createInteraction()
                              throws ResourceException
Creates an Interaction associated with this Connection. An Interaction enables an application to execute EIS functions.
Returns:
Interaction instance
Throws:
ResourceException - Exception if the create operation fails

getLocalTransaction

public LocalTransaction getLocalTransaction()
                                     throws ResourceException
Returns an LocalTransaction instance that enables a component to demarcate resource manager local transactions on the Connection. If a resource adapter does not allow a component to demarcate local transactions on an Connection using LocalTransaction interface, then the method getLocalTransaction should throw a NotSupportedException.
Returns:
LocalTransaction instance
Throws:
ResourceException - Failed to return a LocalTransaction instance because of a resource adapter or EIS error.
NotSupportedException - Demarcation of Resource manager local transactions is not supported on this Connection.

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws ResourceException
Sets the AutoCommit mode for the Connection.
Parameters:
autoCommit - true sets autoCommit mode on; false sets autoCommit mode to be off
Throws:
ResourceException - Failed to set the autoCommit mode or if the connection is participating in an on-going transaction

getAutoCommit

public boolean getAutoCommit()
                      throws ResourceException
Gets the AutoCommit mode for the Connection.
Returns:
true if autoCommit mode is on; false otherwise
Throws:
ResourceException - Failed to get the autoCommit mode

getMetaData

public ConnectionMetaData getMetaData()
                               throws ResourceException
Gets the information on the underlying EIS instance represented through an active connection.
Returns:
ConnectionMetaData instance representing information about the EIS instance
Throws:
ResourceException - Failed to get information about the EIS instance

getResultSetInfo

public ResultSetInfo getResultSetInfo()
                               throws ResourceException
Gets the information on the ResultSet functionality supported by a connected EIS instance.
Returns:
ResultSetInfo instance
Throws:
ResourceException - Failed to get resultSet related information
NotSupportedException - ResultSet functionality is not supported

close

public void close()
           throws ResourceException
Initiates close of the connection handle at the application level. A client should not use a closed connection to interact with an EIS.
Throws:
ResourceException - Close operation failed