146 lines
8.7 KiB
HTML
146 lines
8.7 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="Setting system name, user ID, and password with an AS400 object in the i5/OS Java virtual machine" />
|
|
<meta name="abstract" content="The AS400 object allows special values for system name, user ID, and password when the Java program is running on the IBM Developer Kit for Java (i5/OS) Java virtual machine (JVM)." />
|
|
<meta name="description" content="The AS400 object allows special values for system name, user ID, and password when the Java program is running on the IBM Developer Kit for Java (i5/OS) Java virtual machine (JVM)." />
|
|
<meta name="DC.Relation" scheme="URI" content="jvm.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="valuesum.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="jvmset" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Setting system name, user ID, and password with an AS400 object in
|
|
the i5/OS Java virtual
|
|
machine</title>
|
|
</head>
|
|
<body id="jvmset"><a name="jvmset"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Setting system name, user ID, and password with an AS400 object in
|
|
the i5/OS Java virtual
|
|
machine</h1>
|
|
<div><p>The AS400 object allows special values for system name, user ID,
|
|
and password when the Java™ program is running on the IBM<sup>®</sup> Developer
|
|
Kit for Java (i5/OS™) Java virtual machine (JVM).</p>
|
|
<div class="section"><p>When you run a program on the i5/OS JVM, be aware of some special values
|
|
and other considerations:</p>
|
|
<ul><li>User ID and password prompting is disabled when the program runs on the
|
|
server. For more information about user ID and password values in the server
|
|
environment, see <a href="valuesum.htm#valuesum">Summary of user ID and
|
|
password values on an AS400 object</a>.</li>
|
|
<li>If system name, user ID, or password is not set on the AS400 object, the
|
|
AS400 object connects to the current server by using the user ID and password
|
|
of the job that started the Java program. <strong>A password must be supplied
|
|
when using record-level access while connecting to v4r3 and earlier machines.
|
|
When connecting to a v4r4 or later machine, it can extend the signed-on user's
|
|
password like the rest of the IBM Toolbox for Java components.</strong></li>
|
|
<li>The special value, <strong>localhost</strong>, can be used as the system name. In
|
|
this case, the AS400 object connects to the current server.</li>
|
|
<li>The special value, <strong>*current</strong>, can be used as the user ID or password
|
|
on the AS400 object. In this case, the user ID or password (or both) of the
|
|
job that started the Java program is used. For more information
|
|
about *current, see the following <a href="#jvmset__note">Notes</a>.</li>
|
|
<li>The special value, <strong>*current</strong>, can be used as the user ID or password
|
|
on the AS400 object when the Java program is running on the i5/OS JVM of
|
|
one iSeries™ server,
|
|
and the program is accessing resources on another iSeries server. In this case, the user
|
|
ID and password of the job that started the Java program on the source system are used
|
|
when connecting to the target system. For more information about *current,
|
|
see the following <a href="#jvmset__note">Notes</a>. <p><span class="synph" id="jvmset__note"><a name="jvmset__note"><!-- --></a><span class="kwd"></span></span><strong>Notes:</strong></p>
|
|
<ul><li>The Java program cannot set the password to "*current" if
|
|
you are using record-level access and V4R3 or earlier. When you use record-level
|
|
access, "localhost" is valid for system name and "*current" is valid for user
|
|
ID; however, the Java program must supply the password.</li>
|
|
<li>*current works only on systems running at Version 4 Release 3 (V4R3) and
|
|
later. Password and user ID must be specified on system running on V4R2 systems.</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Examples</h4><p>The following examples show how to use
|
|
the AS400 object with the i5/OS JVM.</p>
|
|
</div>
|
|
<div class="section"><p><strong>Example: Creating an AS400 object when the i5/OS JVM is
|
|
running a Java program</strong></p>
|
|
<p>When a Java program
|
|
is running in the i5/OS JVM, the program does not need to supply a system
|
|
name, user ID, or password.</p>
|
|
<div class="note"><span class="notetitle">Note:</span> You <strong>must</strong> supply a password when
|
|
using record-level access.</div>
|
|
<p>If these values are not supplied, the
|
|
AS400 object connects to the local system by using the user ID and password
|
|
of the job that started the Java program.</p>
|
|
<p>When the program is
|
|
running on the i5/OS JVM,
|
|
setting the system name to <strong>localhost</strong> is the same as not setting the
|
|
system name. The following example shows how to connect to the current server:</p>
|
|
<pre> // Create two AS400 objects. If the Java program is running in the
|
|
// i5/OS JVM, the behavior of the two objects is the same.
|
|
// They will connect to the current server using the user ID and
|
|
// password of the job that started the Java program.
|
|
AS400 sys = new AS400()
|
|
AS400 sys2 = new AS400("localhost")</pre>
|
|
</div>
|
|
<div class="section"><p><strong>Example: Connecting to the current server with a different
|
|
user ID and password from the program that started the job</strong> The Java program
|
|
can set a user ID and password even when the program is running on the i5/OS JVM.
|
|
These values override the user ID and password of the job that started the Java program.</p>
|
|
<p>In
|
|
the following example, the Java program connects to the current server,
|
|
but the program uses a user ID and password that differs from those of the
|
|
job that started the Java program.</p>
|
|
<pre> // Create an AS400 object. Connect to the current server but do
|
|
// not use the user ID and password of the job that started the
|
|
// program. The supplied values are used.
|
|
AS400 sys = new AS400("localhost", "USR2", "PSWRD2")</pre>
|
|
</div>
|
|
<div class="section"><p><strong>Example: Connecting to a different server by using the user
|
|
ID and password of the job that started the Java program</strong></p>
|
|
<p>A Java program
|
|
that is running on one server can connect to and use the resources of other iSeries servers.</p>
|
|
<p>If <strong>*current</strong> is
|
|
used for user ID and password, the user ID and password of the job that started
|
|
the Java program
|
|
is used when the Java program connects to the target server.</p>
|
|
<p>In
|
|
the following example, the Java program is running on one server, but
|
|
uses resources from another server. The user ID and password of the job that
|
|
started the Java program are used when the program connects to the
|
|
second server.</p>
|
|
<pre> // Create an AS400 object. This program will run on one server
|
|
// but will connect to a second server (called "target").
|
|
// Because <strong>*current</strong> is used for user ID and password, the user
|
|
// ID and password of the job that started the program will be
|
|
// used when connecting to the second server.
|
|
AS400 target = new AS400("target", "*current", "*current")</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<ul class="ullinks">
|
|
<li class="ulchildlink"><strong><a href="valuesum.htm">Summary of user ID and password values on an AS400 object</a></strong><br />
|
|
The following table summarizes how the user ID and password values
|
|
on an AS400 object are handled by a Java program running on a server compared
|
|
to a Java program
|
|
running on a client.</li>
|
|
</ul>
|
|
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="jvm.htm" title="The IBM Toolbox for Java classes run on the IBM Developer Kit for Java (i5/OS) Java virtual machine (JVM).">i5/OS Java virtual machine</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |