Class SessionInfo
DBMS_APPLICATION_INFO.SET_MODULE
once when a connection is opened.
Without this a session shows up in V$SESSION as a bare username with a null
MODULE, and every connection from every application that shares the account looks
identical. That matters here more than it does for an ordinary application, because a generated
DAO layer is deliberately a service account shape — one Oracle user for all callers — so
the username identifies nobody. MODULE is the first column a DBA groups by when a session
is blocking, burning CPU, or holding a lock, and it is what DBMS_MONITOR and AWR key their
per-module aggregates on.
Set at connect time and left alone. SET_MODULE costs one round trip on a connection
that has just paid for a login, which is not worth optimising away.
Failure is never fatal
This throws SQLException rather than swallowing it, so the caller decides — and both
callers log and carry on. Naming a session is a diagnostic courtesy; refusing to connect because
the courtesy failed would trade a working application for a tidy view. DBMS_APPLICATION_INFO
is granted to PUBLIC on a stock install, so a failure here means someone revoked it
deliberately, and their application should still run.
Lengths
Oracle truncates module_name at 48 bytes and action_name at 32, silently. We
truncate first so that what we asked for is what the view shows, rather than discovering the
limit through a mysteriously clipped name. The cut is by character, so a multi-byte name can still
exceed the byte limit and be clipped further by Oracle — harmless, and not worth a byte-aware
substring for values that are ASCII class names in practice.
Copyright 2003-2026 ATB Consultancy Services Ltd
(formerly Orinda Software Ltd, Dublin, Ireland)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intOracle truncatesaction_namebeyond this many bytes.static final StringAction recorded by the generator's connection.static final StringModule recorded by the generator's own connection — the one that reads the data dictionary, not one a generated application opens.static final intOracle truncatesmodule_namebeyond this many bytes. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidsetModule(Connection theConnection, String theModule, String theAction) Record this session's module and action inV$SESSION.static StringCut a value to what Oracle will store, leaving null and short values untouched.
-
Field Details
-
MODULE_MAX_LENGTH
public static final int MODULE_MAX_LENGTHOracle truncatesmodule_namebeyond this many bytes.- See Also:
-
ACTION_MAX_LENGTH
public static final int ACTION_MAX_LENGTHOracle truncatesaction_namebeyond this many bytes.- See Also:
-
GENERATOR_MODULE
Module recorded by the generator's own connection — the one that reads the data dictionary, not one a generated application opens.Now taken from
Namer.param_prod_name, having been a literal until 2026-08-07. It was a literal for a reason that has since gone away: the Namer constants were unresolved placeholders, so reading one would have put the string"SUBST_PROD_NAME"intoV$SESSION. They hold real branding now, and this is the value a DBA groups by when a session is blocking — so it should follow the product name rather than be retyped beside it.- See Also:
-
GENERATOR_ACTION
Action recorded by the generator's connection. Every such connection does the same thing — read the dictionary — whether it was opened by the Swing UI, a batch run, or the web Design page, so one value is honest for all three.- See Also:
-
-
Method Details
-
setModule
public static void setModule(Connection theConnection, String theModule, String theAction) throws SQLException Record this session's module and action inV$SESSION.- Parameters:
theConnection- the connection to name; a null one is ignoredtheModule- application name, truncated toMODULE_MAX_LENGTH; null clears ittheAction- what it is doing, truncated toACTION_MAX_LENGTH; null clears it- Throws:
SQLException- if the call fails — see the class comment on why callers absorb this
-
truncate
-