TYPO3 v8 has reached its end-of-life March 31st, 2020 and is not maintained by the community anymore.
You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.
Accessing the database¶
TYPO3 version 8 LTS¶
The TYPO3 database should always be accessed using the QueryBuilder of Doctrine.
TYPO3\CMS\Core\Database\ConnectionPool class can be used to create
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tablename');
See the Database Access API documentation for details.
For TYPO3 versions before 8 LTS¶
The TYPO3 database should always be accessed through the use of
$GLOBALS['TYPO3_DB']. This is the instance of the
DatabaseConnection class from
The same rule applies for accessing non-TYPO3 databases: they should be accessed by using a different instance of the same class. Failing this condition may corrupt the TYPO3 database or prevent access to the TYPO3 database for the rest of the script.