Consultor Eletrônico



Kbase P101747: Cannot handle all connection errors with a CONNECT NO-ERROR
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/03/2005
Status: Unverified

SYMPTOM(s):

Cannot handle all connection errors with CONNECT NO-ERROR

The server or the system has no more resources. Try a larger -n. (748)


The server or the system has no more resources. Please contact Progress Technical Support (748)

** Server rejected login. (700)

CAUSE:

19961028-001 Fixed as a DOC bug in 9.1A
Known issue taken as a documentation bug. For the CONNECT Statement, NO-ERROR will suppress errors in the act of connecting, but not server errors themselves. If the database or a server for the database could not be found, that kind of error will be caught by NO-ERROR. The situation produced above is a server-type error being echoed back to the client.
This is analogous to the case of run file.p no-error. If an error occurs in the act of invoking file.p, then the error is suppressed, but if somthing happens inside file.p (for example, file.p does not compile), one can still see the error.
Since 9.1A, the documentation says the following about the NO-ERROR option for the CONNECT Statement:
Suppresses errors in the act of connecting. This does not mean that all errors produced by the server are suppressed; only errors caused by the CONNECT statement itself. For example, if the server to which you are connecting runs out of resources, its error message will not be suppressed. If a CONNECT error occurs (for example, the database does not exist or is in use in single-user mode), error information is written to the ERROR-STATUS system handle.
You also can use the CONNECTED function to determine whether the CONNECT succeeded and then retrieve error messages from the ERROR-STATUS handle.

FIX:

It is not possible to prevent the error messages 700 and 748 to pop up, however one can still handle the error by trapping the STOP condition that results from this situation, as illustratted bellow:
DEFINE VARIABLE cError AS CHARACTER NO-UNDO.
DEFINE VARIABLE cConnect AS CHARACTER NO-UNDO.
DEFINE VARIABLE iError AS INTEGER NO-UNDO.
cConnect = "-db sports -S 3010 ".
DO ON STOP UNDO, LEAVE:
CONNECT VALUE(cConnect) NO-ERROR.
END.
IF NOT CONNECTED("sports")
THEN DO iError = 1 TO ERROR-STATUS:NUM-MESSAGES:
cError = cError + "~n" + ERROR-STATUS:GET-MESSAGE(iError).
END.
MESSAGE "Could not connect to the database." SKIP
"Progress raised the following errors:"
cError VIEW-AS ALERT-BOX INFO BUTTONS OK.