Make note of the complete error message. This is important for
accurate troubleshooting of the error. The error message format is
[Vendor][ODBC-Component][Data Source] "<Error Message>"
where:
- Vendor provides the name of the ODBC driver's vendor.
- ODBC-Component provides name of the ODBC component where
the error was generated.
- Data Source provides name of the data source. This may not
always be present in the error message. If this is specified in
the error, the connection has been made to the data source, and
an error has occurred after that connection has been established.
- Error Message provides the specific error that was generated.
Please include as many of the above components of the error message
as are available.
To obtain the error message:
a. Obtain the return value of the Connectivity Kit function:
handle = DBCONNECT("test","myid","mypasswd","")
? handle
b. Initiate two variables, one numeric and one character:
errmsg = ""
errno = 0
c. Use the DBError() function to find the error:
If the result is -1:
errtype = DBError(handle,@errmsg,@errno)
If the result is -2:
errtype = DBError(0,@errmsg,@errno)
IMPORTANT: The variables passed to the DBError() function must
be passed by reference.
The following program is an example of how to include an
error-checking routine:
errmsg = ""
errno = 0
connect = "test"
id = "<user id>"
password = "<user password>"
conn_str = "<connection string>"
handle = DBConnect(connect,id,password,conn_str)
DO CASE
CASE handle = -1
= DBError(handle,@errmsg,@errno)
?errmsg
CASE handle = -2
= DBError(0,@errmsg,@errno)
?errmsg
ENDCASE