here is my code which works very well, but if the 'dbserver' server does not respond, joomla does not work either and displays the error 2002 :
$option=array();
$option['driver'] = 'mysqli'; // Database driver name
$option['host'] = 'dbserver'; // Database Host name
$option['user'] = 'login'; // User for database authentication
$option['password'] = 'password'; // Password for database authentication
$option['database'] = 'db'; // Database name
$option['prefix'] = ''; // Database prefix (may be empty)
$db=JDatabaseDriver::getInstance($option);
try {
$db->transactionStart();
$db->setUTF();
$query=$db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('status'));
$db->setQuery($query);
$result = $db->execute();
if($result===false)
$db->transactionRollback();
else
{
$db->transactionCommit();
$liste=$db->loadAssocList();
...
}
}
catch (Exception $e) {
$db->transactionRollback();
}
I tried adding a "try/catch" and a "transaction" to handle the error, but it doesn't change anything.
that errors can be managed
the site is down
Joomla 4.0.4
Labels |
Added:
No Code Attached Yet
|
Labels |
Added:
Information Required
|
Labels |
Added:
Information Required
|
Labels |
Added:
Information Required
|
no, it is not resolved
Labels |
Added:
bug
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-08-31 10:17:33 |
Closed_By | ⇒ | brianteeman |
I am closing this as it relates to custom code and the original reporter is no longer using github so they wont see any responses.
Did you resolve this?