Home > PHP > Function > > db2_conn_error()

db2_conn_error()

db2_conn_error - Returns a string containing the SQLSTATE returned by the last connection attempt

Syntax

string db2_conn_error (resource $connection)

Arguments

  • connection - A connection resource associated with a connection that initially succeeded, but which over time became invalid.

Description

db2_conn_error() returns an SQLSTATE value representing the reason the last attempt to connect to a database failed. As db2_connect() returns FALSE in the event of a failed connection attempt, you do not pass any parameters to db2_conn_error() to retrieve the SQLSTATE value.

Version

PHP PECL ibm_db2 >= 1.0.0

Return value

Returns the SQLSTATE value resulting from a failed connection attempt. Returns an empty string if there is no error associated with the last connection attempt.