PHP 8.1.0 Alpha 1 available for testing


(PHP 4, PHP 5, PHP 7, PHP 8)

odbc_closeClose an ODBC connection


odbc_close ( resource $odbc ) : void

Closes down the connection to the database server.

Список параметров


Идентификатор соединения ODBC, за подробностями обращайтесь к odbc_connect().

Возвращаемые значения

Эта функция не возвращает значения после выполнения.



This function will fail if there are open transactions on this connection. The connection will remain open in this case.

add a note add a note

User Contributed Notes 1 note

alvaro at demogracia dot com
3 years ago
`odbc_close()` does not report success and some drivers (namely Microsoft Access) don't seem to close connections at first attempt. This is normally not an issue, unless you need to establish many connections within the script lifetime.

You can use the fact that resource type changes (e.g. from "odbc link" to "Unknown") as a trick to figure out whether connection was successfully closed (and eventually retry):

= get_resource_type($conn);
$wait_until = time() + 3;
do {
} while (
get_resource_type($conn)===$type && time()<$wait_until);
To Top