Search code examples
phpiismdb2

fatal error call to undefined method MDB2_error::disconnect()


I am running a php script in command line that connects to a oracle and mssql to fetch some data and write to a file. Actually it was a cron on linux machine which needed to be transfered to windows 2008.

The command is throwing the error:

fatal error call to undefined method MDB2_error::disconnect() in path\to\script.php in line63

The code around line 63 are:

$db_clw = MDB2::factory($config->database->CLW->dsn);
if (PEAR::isError($db_clw)) {
    $db_clw->disconnect();
    $db_banner->disconnect();
    die($db->getMessage());
}

any idea?


Solution

  • You are calling the disconnect method on a MDB2 error object. That method does not have a disconnect method.

    $db_clw = MDB2::factory($config->database->CLW->dsn);
    if (PEAR::isError($db_clw)) {
        $db_clw->disconnect();
    //           ^ method does not exist
        $db_banner->disconnect();
        die($db->getMessage());
    }