Positioning database references in an application
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
If possible, isolate database references within your
application to help minimize the effects of a database connection
failure on your application. This allows you to use the CONNECTED function effectively
to test for a particular database connection, prior to passing program control
to a subprocedure that accesses that database.

The above figure shows a main procedure that connects two databases
and runs subprocedures, depending on whether or not a database is
connected. If the CONNECT statement in mainproc.p fails
to connect db2, only db2proc.p subprocedure
is effected by the database connection failure. This technique is useful
for applications that run subprocedures from a menu.
Do not reference a database in your application startup procedure, except possibly to connect it. Remember, you cannot connect to a database and reference a database in the same procedure. If you reference a database on an auto-connect list within the startup procedure of your application and the auto-connect fails for that database, the startup procedure does not run.