Hi,
iām writing my custom scheduler function where a PDO connection is made to retrieve some information.
Iāve create, like usual, a try and catch block in order to catch exceptions but it wonāt works.
Any suggestion on this?
Regards
Hi,
iām writing my custom scheduler function where a PDO connection is made to retrieve some information.
Iāve create, like usual, a try and catch block in order to catch exceptions but it wonāt works.
Any suggestion on this?
Regards
Even though this is a PHP question, we can try helpingā¦ but we would have to see the code. Often the problem is just a small detail or even punctuationā¦ it is only possible to see by reading the exact code.
Yesā¦sure
Just for exampleā¦a simple pdo connection to external database:
function importHubs(){
$GLOBALS[ālogā]->FATAL(ā************************ Hubs Import START ***************ā);
$GLOBALS[ālogā]->FATAL(' Connecting to DATAWAREHOUSE ā);
try{
$dsn = āmysql:host=.;dbname=ā;
$options = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];
$PDOconn = new PDO($dsn, āusernameā , āpasswordā, $options);
} catch (PDOException $e){
$GLOBALS[ālogā]->FATAL(' OPS !!! NOT CONNECTED to DATAWAREHOUSE *************ā);
$GLOBALS[ālogā]->FATAL($e->getMessage());
return false;
}
//$PDOconn->query("bla bla bla");
$GLOBALS['log']->FATAL('*************** WHAO !!!!! CONNECTED to DATAWAREHOUSE *************');
return true;
}
This script for example does not generate any exception.
Using it outside SuiteCRM the exception was capturedā¦
Any hint?
Regards
Sorryā¦the example above seems to work.
Maybe some typo in my previous code.
This can be considered as solved.
really sorry