Consultor Eletrônico



Kbase 19578: Different Ways to Connect to an AS/400 Database
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

GOAL:

How to connect to an AS/400 database using TCP/IP protocol.

FACT(s) (Environment):

IBM AS/400

FIX:

The AS/400 operating system requires a UserID/password in order to log onto the system, therefore Progress startup parameters such as -U and -P are needed for the connection.

One way to establish the connection is to specify the parameters on the DB2/400 DataServer Schema within the Connection Parameters line.
The syntax is:

-H host-name -N tcp -S service-name -U username -P password

Another way is to connect from the Procedure Editor with the connect statement:

connect schemaholder -1 /* schema holder connection */
connect as400db -H host-name -N tcp -S service-name -U
username -P
password. /* DataServer schema connection */

A connection can also be made from within a 4GL program.

This is an example that asks for the UserID/password.
Note that both UserID and password are case sensitive. They must be in capital letters:

DEFINE VARIABLE id AS CHAR FORMAT "x(8)".
DEFINE VARIABLE password AS CHAR FORMAT "x(8)".
DEFINE VARIABLE args AS CHAR FORMAT "x(40)".
UPDATE SPACE (2) id LABEL "UserID" SKIP password BLANK WITH CENTERED
ROW 8 SIDE-LABELS ATTR-SPACE
TITLE " Login to Database ".
args = " -U " + id + " -P " + password.
HIDE ALL.
/* Connect to the database schema holder */
CONNECT sh_ewdv8 -1.
/* Connect to the DB2/400 DataServer database */
CONNECT EWDV8 VALUE(args).