sqlj.runtime

Interface ConnectionContext


public interface ConnectionContext

The ConnectionContext interface provides a set of methods that manage a set of SQL operations performed during a session with a specific database. A ConnectionContext object maintains a JDBC Connection object on which dynamic SQL operations are permitted to be performed. It also contains a default ExecutionContext object by which SQL operation execution semantics are permitted to be queried and modified.

In addition to those methods defined by this interface, a concrete implementation of a ConnectionContext object provides constructors described in Database Connection Context in the Development Manual.


Field Summary
static boolean CLOSE_CONNECTION
          Constant indicating that the underlying JDBC Connection should be closed.
static boolean KEEP_CONNECTION
          Constant indicating that the underlying JDBC Connection should not be closed.
 
Method Summary
 void close()
          Releases all resources used in maintaining database state on this ConnectionContext object and closes the underlying JDBC Connection object.
 void close(boolean closeConnection)
          Releases all resources used in maintaining database state on this ConnectionContext object.
 sqlj.runtime.profile.ConnectedProfile getConnectedProfile(Object profileKey)
          This method is for internal use.
 Connection getConnection()
          Returns the underlying jdbc connection object associated with this context instance.
 ExecutionContext getExecutionContext()
          Returns the default ExecutionContext object of this ConnectionContext object.
 Map getTypeMap()
          Type maps are not supported by Open SQL / SQLJ.
 boolean isClosed()
          Determines wether this ConnectionContext object has already been closed.
 

Field Detail

CLOSE_CONNECTION

static final boolean CLOSE_CONNECTION
Constant indicating that the underlying JDBC Connection should be closed.

See Also:
KEEP_CONNECTION, close(), close(boolean), Constant Field Values

KEEP_CONNECTION

static final boolean KEEP_CONNECTION
Constant indicating that the underlying JDBC Connection should not be closed.

See Also:
CLOSE_CONNECTION, close(), close(boolean), Constant Field Values
Method Detail

getConnectedProfile

sqlj.runtime.profile.ConnectedProfile getConnectedProfile(Object profileKey)
                                                          throws SQLException
This method is for internal use. Application coding shall not call it directly. It can be changed incompatibly at any time.

Throws:
SQLException

getConnection

Connection getConnection()
Returns the underlying jdbc connection object associated with this context instance. Note that depending on construction, the returned connection may be shared between many connection context instances.

Returns:
the underlying JDBC connection object associated with this connection context object.

close

void close()
           throws SQLException
Releases all resources used in maintaining database state on this ConnectionContext object and closes the underlying JDBC Connection object. This method is equivalent to close(CLOSE_CONNECTION).

Note: A context is not automatically closed when it is garbage collected. Therefore, it should be closed in a finally block. Also, the underlying JDBC connection will not be automatically closed when it is garbage collected.

Throws:
SQLException - if unable to close the connection context object
See Also:
close(boolean)

close

void close(boolean closeConnection)
           throws SQLException
Releases all resources used in maintaining database state on this ConnectionContext object. Since the underlying JDBC Connection object managed by this connection context object is permitted to be shared between multiple ConnectionContext objects, it is not always desirable to close the underlying JDBC Connection object when close() is called. If the constant KEEP_CONNECTION is passed as the parameter closeConnection, the underlying JDBC Connection object is not closed. Otherwise, if the constant CLOSE_CONNECTIONConnection object is closed.

If the method is called with CLOSE_CONNECTION and the underlying Connection object has been obtained from a pooled data source, the connection is not physically closed but returned to the pool.

Note: A context is not automatically closed when it is garbage collected. Therefore, it should be closed in a finally block. Also, the underlying JDBC connection will not be automatically closed when it is garbage collected.

Parameters:
closeConnection - is true if the underlying Connection should also be closed.
Throws:
SQLException - if unable to close the connection context object
See Also:
KEEP_CONNECTION, CLOSE_CONNECTION, close()

isClosed

boolean isClosed()
Determines wether this ConnectionContext object has already been closed.

Returns:
true if this context has been closed; false otherwise.
See Also:
close(), close(boolean)

getExecutionContext

ExecutionContext getExecutionContext()
Returns the default ExecutionContext object of this ConnectionContext object. The default ExecutionContext object is the ExecutionContext object used if no explicit ExecutionContext object is supplied during the execution of a particular SQL operation. Any changes made to the object returned by this method are visible in this ConnectionContext object.

Returns:
the default ExecutionContext object used by this ConnectionContext object.
See Also:
ExecutionContext

getTypeMap

Map getTypeMap()
               throws SQLException
Type maps are not supported by Open SQL / SQLJ.

Throws:
SQLException
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] ENGINEAPI [sap.com] opensqldeprecated default BC-JAS-PER-SQL
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.libdeprecated default BC-JAS
[sap.com] ENGFACADE [sap.com] tc/je/opensql/api api BC-JAS


Copyright 2012 SAP AG Complete Copyright Notice