|
As a "special register" value, the client user identifier should
be usable in the same manner as the other special registers. The
special registers can be referred to in most cases as "CURRENT
register_reserved_word" to represent some value in the data type &
attributes that defines the register; the CLIENT_USERID is a
VARCHAR(255) value. For example there is the USER special register
which can be used in a SELECT [INTO] or a VALUES statement to
retrieve the user for the session, and that value could be inserted
into a TABLE. As an effective variable, the special register can be
compared against as an operand in a predicate similar to a literal,
variable, or column. Thus a VIEW or stored procedure might might
encapsulate a "SELECT SomeColumn FROM SomeFile WHERE CompareColumn =
CURRENT USER" to limit which data the requester can access via the
SomeFile TABLE or VIEW.
The CLIENT USERID and its parent topic SPECIAL REGISTERs:
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzcurcluser.htm
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/db2/rbafzspecreg.htm
The client userid could be stored in a row of a TABLE, but the
column would need to be defined in the CREATE TABLE just as for most
any other data; i.e. there is no implicit[ly] hidden column in all
tables from which the "updated by" client id could be retrieved.
Thus from the above SELECT example, the create table for SomeFile
would need to include the CompareColumn column in the column list
and specify a data type and attributes compatible with the special
register, for how the column & register will be used in the application.
Regards, Chuck
Ashish Kulkarni wrote:
--
I was looking into this new method setClientInfo added in
AS400JDBCConnection class, and was not sure what would this do
I added as400JDBCConn.setClientInfo("ClientUser", "MYUSERID");
and in the job log of this connection I see:
The following special registers have been set: CLIENT_USERID:
MYUSERID
But I am not sure how can I use this, any ideas? Will this be
used when updating table, so I could know who updated this
table?
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.