× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi
Thanks for the information, so if i want to use CLIENT_USERID to update or
insert data in table to keep track of who updated the row, i can have a
query
insert into MYTABLE (USER_ID, COLUM1, COLUM2) values (CURRENT CLIENT_USERID,
'DATA1', DATA2');
and user_id column will be populated with the user it set in
*as400JDBCConn.setClientInfo("ClientUser", "MYUSERID");*
*
*
Columns USER_ID should be of length 255 VARCHAR to support this insert
*
*
*Regards*
*Ashish*
*
*
On Wed, Feb 10, 2010 at 4:01 PM, CRPence <CRPbottle@xxxxxxxxx> wrote:

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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.