Handling CONNECT Errors
From InterBase
Go Up to Opening a Database
The WHENEVER
statement should be used to trap and handle runtime errors that occur during database declaration. The following C code fragment illustrates an error-handling routine that displays error messages and ends the program in an orderly fashion:
. . . EXEC SQL WHENEVER SQLERROR GOTO error_exit; . . . :error_exit isc_print_sqlerr(sqlcode, status_vector); EXEC SQL DISCONNECT ALL; exit(1); . . .
For a complete discussion of SQL error handling, see Error Handling and Recovery.