4.1. Connection error numbers and messages

If your application has successfully opened a connection to a database, all operations on this connection may cause errors. There are two classes of errors:

Client library errors

libdbi retrieves and stores the error codes of the database engine client library if it provides error codes in a suitable format. If the client library does not support error numbers as positive integers, the value DBI_ERROR_CLIENT indicates an error status instead. In addition a string may be provided which describes or further elaborates the error status. The possible values of error number and error message depend on the database engine used for the connection.

libdbi errors

A number of errors may occur within the libdbi framework or within a database driver, e.g. if your program queries nonexistent columns or attempts to read past the last row of a result set. The possible error numbers and error messages are predefined by libdbi.

Use the function dbi_conn_error to access the error number and error message of the most recent connection operation.