Consultor Eletrônico



Kbase P130271: How to reconnect to a database after an error in the AppServer or WebSpeed agent
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/5/2009
Status: Verified

GOAL:

How to reconnect to a database after an error in the AppServer or WebSpeed agent

GOAL:

How to avoid error 8026 when reconnecting to a database automatically

GOAL:

How to use the activation or startup procedure to connect or reconnect to a database using the 4GL

GOAL:

Activation procedure ended with an STOP condition. (8026)

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
All Supported Operating Systems

FIX:

The overall procedure to ensure that a database is connected for an AppServer or WebSpeed agent is to implement the following steps:
1. test whether the database is currently connected
2. if the test fails, (re)connect the database.
However, due to the semantics of the 4GL the implementation needs to take care of the following items:
- connecting/disconnecting a database while a transaction is active is not possible. (if a transaction is currently active, any disconnect attempt is deferred, and disconnect/connect couples cancel each other with no effect)
- the CONNECTED function only checks a flag and does not actually check whether the database is reachable and the connection is still connected. Instead, the best way to test a connect is to force communication with the database server, for instance using the TIME function or accessing a record in the database.
- if an ABL procedure requires a database to load (for instance when it references a table name), it will raise a STOP condition if the database is not connected even before its execution start. The STOP condition needs to be tested in the calling procedure.
- as a result, the test for whether the database is connected and the connect/disconnect statements need to be placed in different procedures, with appropriate error handling at the top level.
The notes below describe possible implementations for an automatic connect/disconnect