I don't think that this will be directly possible. But indirectly - you could run a very small and fast dummy-query which might return only one single record which could be checked - maybe within a check-loop with error-mode: ErrorHandling in Qlikview
Your connection is succesful when the CONNECT (or CONNECT32 or CONNECT64) statements return without an error (ScriptError = 0). By default, script execution is allowed to continue whenever the current statement succeeds.
Checking for an unsuccessful connection is easier because on average that is the condition about which ample information is available. After a CONNECT, check for ScriptError<>0. On the other hand, by default the script engine will notify you about a failed connection in very clear wording, so you may not have any checking to do after all.