Connect to an OpenEdge database from PAS for OpenEdge
- Last Updated: August 17, 2021
- 3 minute read
- OpenEdge
- Version 12.2
- Documentation
The OpenEdge Relational Database Management System (RDBMS) network connection policy allows for one network connection per ABL session in the PAS for OpenEdge multi-session agent. Therefore, the application code and PROMON monitoring are the same for both servers.
However, the self-service RDBMS connection policy works differently.
Self-service connections are a shared resource in PAS for OpenEdge. Each multi-session agent
creates a single self-service connection that will show up in PROMON as its own user connection.
Therefore, each ABL session that executes with a database connection parameter -db or that executes an ABL CONNECT
statement shares the self-service connection from its managing multi-session agent and shows up
on PROMON with its own user connection. Each ABL session user connection is specific to that
session and to no other session. No single ABL session user connection binds in any way the user
connection of any other ABL session.
For information about database management, see the Database Administration in Manage the OpenEdge Database.
-
SELF/PASA— A multi-session agent's shared self-service database connection -
SELF/PASN— Individual ABL session users that share the multi-session agent connection
OpenEdge ships with a sample OpenEdge database in the
$DLC directory called sports2020 .
- Run the proenv utility.
- Navigate to your OpenEdge work directory. For example:
cd install-path/OpenEdge/WRK - Create a folder to store your database:
mkdir database - Run the following command in proenv to copy the Sports2020 database that
ships with OpenEdge into your work directory:
$DLC/bin/procopy $DLC/sports2020 path-to-openedge-work-directory /database/sports2020Note:$DLCis a UNIX-style environment variable syntax for the directory of your Progress installation. On Windows, use%DLC%. - Change directory to path-to-openedge-work-directory /database .
- Start the database server by running the following command:
proserve sports2020 - Change to the /bin directory of your
PAS for OpenEdge instance. For example:
cd path-to-openedge-work-directory/oepas1/bin - Use the
OEPROPutility to specify the database connection in the Agent Startup Parameter property. The following command shows how to configure a connection to the databasesports2020:oeprop.{bat|sh} AppServer.SessMgr.agentStartupParam=“-db openedge-install-path/WRK/database/sports2020”This command tells the instance to connect to database
sports2020on agent startup. - Save the following code to your
path-to-openedge-work-directory /oepas1/openedge
directory to make it available to your PROPATH as
server.p:DEFINE OUTPUT PARAMETER custname AS CHARACTER. FIND FIRST customer. ASSIGN custname = name. - Restart your instance using the
pasman pasoestartcommand. For example:pasman.{sh|bat} pasoestart -restart -I oepas1 -timeout 200 - Navigate to the OpenEdge working directory.
- Run the
prowin(Windows) or_progres(UNIX) command to open the Procedure Editor. - Run the following ABL code in the Procedure Editor to test the database
connection:
DEF VAR appHandle AS HANDLE. DEF VAR custname AS CHARACTER. DEF VAR cnctParam AS CHARACTER. DEF VAR ret AS LOGICAL. CREATE SERVER appHandle. cnctParam = "-URL http://hostname:port/apsv -sessionModel Session-Managed". ret = appHandle:CONNECT(cnctParam). IF NOT ret THEN DO: MESSAGE "Server not connected". RETURN. END. ELSE DO: MESSAGE "Connected to PAS for OpenEdge!". RUN server.p ON appHandle (OUTPUT custname). MESSAGE "First customer is: " custname. appHandle:DISCONNECT(). MESSAGE "Disconnected from PASOE". END. QUIT.Note: Modify thecnctParamwith the hostname and port of your instance.This code displays the first customer name in the
sports2020database. You can save this procedure asclient.pif you wish to use this procedure as a reference.