|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A connection context manages a set of SQL operations performed during a session with a specific database. A connection context maintains an JDBC Connection instance on which dynamic SQL operations may be performed. It also contains a default execution context object by which sql operation execution semantics may be queried and modified.
In addition to those methods defined by this interface, each concrete implementation of a connection context, UserCtx, will provide the following methods:
public static Object getProfileKey(sqlj.runtime.profile.Loader l, String profileName) throws SQLException;Returns a profile key for a particular profile loader and name.
public static sqlj.runtime.profile.Profile getProfile(Object key);Returns a top-level profile for a particular profile key
public static UserCtx getDefaultContext();Returns the default context for the UserCtx class.
public static void setDefaultContext(UserCtx dflt);Sets the default context for the UserCtx class.
public UserCtx(java.sql.Connection conn) throws SQLException;
public UserCtx(String url, String user, String pwd, boolean autoCommit) throws SQLException;
public UserCtx(String url, Properties info, boolean autoCommit) throws SQLException;
public UserCtx(String url, boolean autoCommit) throws SQLException;
public UserCtx(ConnectionContext other) throws SQLException;
Note that for any context constructor which creates a JDBC connection during construction, that connection will be automatically closed if the constructor call throws an exception. For any context constructor which uses an already opened JDBC connection (or context) passed from the client, that connection (or context) will remain open even if the constructor call throws an exception.
Field Summary |
Type | Field |
---|---|
static boolean |
CLOSE_CONNECTION
Underlying JDBC Connection should be closed |
static boolean |
KEEP_CONNECTION
Underlying JDBC Connection should not be closed |
Method Summary |
Type | Method |
---|---|
void |
close()
Releases all resources used in maintaining database state on this context, closes any open connected profiles, and closes the underlying jdbc connection. |
void |
close(boolean closeConnection)
Releases all resources used in maintaining database state on this context and closes any open connected profiles manages by this context. |
sqlj.runtime.profile.ConnectedProfile |
getConnectedProfile(java.lang.Object profileKey)
Returns the connected profile associated with a profileKey for this connection context instance. |
java.sql.Connection |
getConnection()
Returns the underlying jdbc connection object associated with this context instance. |
ExecutionContext |
getExecutionContext()
Returns the default execution context used by this connection context. |
java.util.Dictionary |
getTypeMap()
Returns the type map that is underlying this connection context, null of none. |
boolean |
isClosed()
returns true if this context has been closed, false otherwise. |
Field Detail |
public static final boolean CLOSE_CONNECTION
close(boolean)
public static final boolean KEEP_CONNECTION
close(boolean)
Method Detail |
public sqlj.runtime.profile.ConnectedProfile getConnectedProfile(java.lang.Object profileKey) throws java.sql.SQLException
The profileKey object must be an object that was returned via a prior call to getProfileKey(). An exception is raised if a connected profile instance could not be created for this connection context.
profileKey
- the key asscoiated with the desired profile.public java.sql.Connection getConnection()
public java.util.Dictionary getTypeMap() throws java.sql.SQLException
public void close() throws java.sql.SQLException
close(CLOSE_CONNECTION)
close(boolean)
public void close(boolean closeConnection) throws java.sql.SQLException
close
is called. If the constant KEEP_CONNECTION is passed, the underlying
jdbc connection is not closed. Otherwise, if the constant
CLOSE_CONNECTION, the underlying connection is closed.
Note: A context is automatically closed when it is garbage collected. A context closed in such a way does not close the underlying JDBC connection since it will also be automatically closed when it is garbage collected.
closeConnection
- is true if the underlying Connection should
also be closed.KEEP_CONNECTION
,
CLOSE_CONNECTION
public boolean isClosed()
close()
,
close(boolean)
public ExecutionContext getExecutionContext()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |