odbc_close

(PHP 4, PHP 5)

odbc_closeClose an ODBC connection

Description

void odbc_close ( resource $connection_id )

Closes down the connection to the database server.

Parameters

connection_id

The ODBC connection identifier, see odbc_connect() for details.

Return Values

No value is returned.

Notes

Note:

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

Коментарии

`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):

<?php
$type 
get_resource_type($conn);
$wait_until time() + 3;
do {
   
odbc_close($conexion_odbc);
} while (
get_resource_type($conn)===$type && time()<$wait_until);
2018-03-26 13:33:26
http://php5.kiev.ua/manual/ru/function.odbc-close.html

    Поддержать сайт на родительском проекте КГБ