odbc_close

(PHP 4, PHP 5)

odbc_closeChiude una connessione ODBC

Descrizione

void odbc_close ( resource $id_connessione )

odbc_close() chiude la connessione con il database server associata all'identificativo di connessione indicato.

Nota: Se ci sono delle transazioni aperte sulla connessione richiesta, la funzione fallisce. In questo caso la connessione resta aperta.

add a note add a note

User Contributed Notes 2 notes

up
0
alvaro at demogracia dot com
29 days 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):

<?php
$type
= get_resource_type($conn);
$wait_until = time() + 3;
do {
   
odbc_close($conexion_odbc);
} while (
get_resource_type($conn)===$type && time()<$wait_until);
up
-25
mallsop at ind dot net
17 years ago
On microsoft servers, use the odbc_free_result command.
To Top