TYPO3 Connect to database
I have quite a long controller / scheduler manager job, database access at the very end. With default MySQL timeout settings, it starts up at "MySQL Server is gone". Increasing the timeout I can get around the error. However, I would like to fix this issue. How can I connect to db (TYPO3 7.6)?
I tried
$GLOBALS['TYPO3_DB']->connectDB();
but it didn't work.
+3
source to share
1 answer
If the connection time is running out, the TYPO3 state DatabaseConnection::$isConnected
is still set. You can try this:
// isConnected() sends a ping and modifies internal $isConnected property
if (!$GLOBALS['TYPO3_DB']->isConnected()) {
// re-connect to database if required
$GLOBALS['TYPO3_DB']->connectDB();
}
+1
source to share