Kbase P119596: How to retrieve the database host name from the 4GL?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
GOAL:
How to retrieve the database host name from the 4GL?
GOAL:
How to know the server name of a connected database?
GOAL:
What is the database host name?
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
FIX:
Use the DBPARAM function in the 4GL.
This function will return the connection parameters for each database connection. By searching the result from DBPARAM for the -H parameter, it is possible to know what host name was used for the connection.
Here is an example program:
DEFINE VARIABLE dbp AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.
DEFINE VARIABLE servername AS CHARACTER NO-UNDO.
REPEAT i = 1 TO NUM-DBS:
dbp = DBPARAM(i).
servername = ?.
REPEAT j = 1 TO NUM-ENTRIES(dbp, ','):
IF ENTRY(j, dbp, ',') BEGINS '-H' THEN DO:
servername = ENTRY(2, ENTRY(j, dbp, ','), ' ').
LEAVE.
END.
END.
DISPLAY LDBNAME(i) servername.
END.