ODBC.close

From FreeSWITCH Wiki
Jump to: navigation, search

Closes and frees up ODBC resources. Please note that as soon as a script finishes executing the engine will automatically close up any ODBC resources. This close method was designed to help you free up those resources for your longer running scripts.

Contents

Synopsis

db.close();

Return value

  • bool - True every time.

Example

//Simple Example
use("ODBC");
var DSN = "test_odbc";
var DB_USER = "abc";
var DB_PASS = "abc";
var db = new ODBC(DSN, DB_USER, DB_PASS);
db.connect();
//Do something with our database connection.
db.close(); 
//Example of opening a connection more than once in your script.
var db = new ODBC(DSN, DB_USER, DB_PASS);
db.connect();
//Do something...
db.close();
db = new ODBC(DSN, DB_USER, DB_PASS);
db.connect();
//Do something...
db.close();

See Also