diff --git a/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php b/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php
index ff30d772f5f56cbd419f9a331303c077c8dff84c..d6b9b7fac7859f2118bbbdf150767c5436b151ba 100644
--- a/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php
+++ b/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php
@@ -297,9 +297,11 @@ abstract class AbstractFunctionModule
 
     /**
      * @return DatabaseConnection
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, use the Doctrine DBAL layer via the ConnectionPool class
      */
     protected function getDatabaseConnection()
     {
+        GeneralUtility::logDeprecatedFunction();
         return $GLOBALS['TYPO3_DB'];
     }
 
diff --git a/typo3/sysext/backend/Classes/Module/BaseScriptClass.php b/typo3/sysext/backend/Classes/Module/BaseScriptClass.php
index 06473463f7cab6b84aab9d6cebe76331ce497bcd..7d3b6ad8d2fd1a1be988ab5dac247185728210e2 100644
--- a/typo3/sysext/backend/Classes/Module/BaseScriptClass.php
+++ b/typo3/sysext/backend/Classes/Module/BaseScriptClass.php
@@ -391,9 +391,11 @@ class BaseScriptClass
 
     /**
      * @return DatabaseConnection
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, use the Doctrine DBAL layer via the ConnectionPool class
      */
     protected function getDatabaseConnection()
     {
+        GeneralUtility::logDeprecatedFunction();
         return $GLOBALS['TYPO3_DB'];
     }
 
diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php
index 2bee5280306675fae353e801b11ceeb824be81e9..6ede5cb6f05a7f70291a5e13ce7311a66d7212cf 100644
--- a/typo3/sysext/backend/Classes/View/PageLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php
@@ -20,7 +20,6 @@ use TYPO3\CMS\Backend\Controller\PageLayoutController;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Database\Query\QueryHelper;
 use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
@@ -2547,14 +2546,6 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
         return $GLOBALS['BE_USER'];
     }
 
-    /**
-     * @return DatabaseConnection
-     */
-    protected function getDatabase()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
     /**
      * @return PageLayoutController
      */
diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php
index cec193076aec5a2128ad8b7637f85c93c2bef4f0..f431ff4dfce1287accbda3e7b0cfd8c80be637d1 100644
--- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php
+++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseEditRowTest.php
@@ -37,9 +37,6 @@ class DatabaseEditRowTest extends UnitTestCase
 
     protected function setUp()
     {
-        $this->dbProphecy = $this->prophesize(DatabaseConnection::class);
-        $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
-
         $this->subject = $this->getMockBuilder(DatabaseEditRow::class)
             ->setMethods(['getDatabaseRow'])
             ->getMock();
diff --git a/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php b/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php
index 66750e674075ce3c76be12e133feb590cb06656b..773c3a61088526d1ccc28889fd89ab6498ef52d8 100644
--- a/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php
+++ b/typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php
@@ -331,14 +331,4 @@ class CategoryCollection extends AbstractRecordCollection implements EditableCol
     {
         return self::$storageItemsField;
     }
-
-    /**
-     * Gets the database object.
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected static function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/core/Classes/Collection/StaticRecordCollection.php b/typo3/sysext/core/Classes/Collection/StaticRecordCollection.php
index a74cf6474f0752412734ca72bc47fa5d1ced57be..8aca02bc9cdd12022893a1bee9196a40ad47cf44 100644
--- a/typo3/sysext/core/Classes/Collection/StaticRecordCollection.php
+++ b/typo3/sysext/core/Classes/Collection/StaticRecordCollection.php
@@ -197,14 +197,4 @@ class StaticRecordCollection extends AbstractRecordCollection implements Editabl
         }
         return $relatedRecords;
     }
-
-    /**
-     * Gets the database object.
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index 895e5435839d789c603ff66bfdb3db0013cfa088..51ea6f64c107ffe445f93c1fbbb2696dc0373793 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -24,7 +24,6 @@ use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
 use TYPO3\CMS\Core\Charset\CharsetConverter;
 use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
 use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
 use TYPO3\CMS\Core\Database\Query\QueryHelper;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
@@ -664,13 +663,6 @@ class DataHandler
      */
     protected static $recordPidsForDeletedRecords = [];
 
-    /**
-     * Database layer. Identical to $GLOBALS['TYPO3_DB']
-     *
-     * @var DatabaseConnection
-     */
-    protected $databaseConnection;
-
     /**
      * Runtime Cache to store and retrieve data computed for a single request
      *
@@ -690,7 +682,6 @@ class DataHandler
      */
     public function __construct()
     {
-        $this->databaseConnection = $GLOBALS['TYPO3_DB'];
         $this->runtimeCache = $this->getRuntimeCache();
     }
 
diff --git a/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php b/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
index f4a2c8add8116b9cec7f4d9d3d6762911c5915c2..7bdd56836cf6064e204988eacb82afe1dde1d3f6 100644
--- a/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
+++ b/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
@@ -45,16 +45,6 @@ class MetaDataRepository implements SingletonInterface
      */
     protected $tableFields = [];
 
-    /**
-     * Wrapper method for getting DatabaseConnection
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
     /**
      * Returns array of meta-data properties
      *
diff --git a/typo3/sysext/core/Classes/Resource/ProcessedFileRepository.php b/typo3/sysext/core/Classes/Resource/ProcessedFileRepository.php
index d1fcfd8532c33ced8d68ba19b46871c41c2d7473..5068248e593e8a2d6edc552c91ec35eba10e26dd 100644
--- a/typo3/sysext/core/Classes/Resource/ProcessedFileRepository.php
+++ b/typo3/sysext/core/Classes/Resource/ProcessedFileRepository.php
@@ -41,18 +41,12 @@ class ProcessedFileRepository extends AbstractRepository
      */
     protected $table = 'sys_file_processedfile';
 
-    /**
-     * @var \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected $databaseConnection;
-
     /**
      * Creates this object.
      */
     public function __construct()
     {
         parent::__construct();
-        $this->databaseConnection = $GLOBALS['TYPO3_DB'];
     }
 
     /**
diff --git a/typo3/sysext/core/Classes/Resource/ResourceFactory.php b/typo3/sysext/core/Classes/Resource/ResourceFactory.php
index c8692fb89d4ff483ac22c960a2231e2b8221bd56..82f61b131aaef78f7d6511a64538511a871b3de0 100644
--- a/typo3/sysext/core/Classes/Resource/ResourceFactory.php
+++ b/typo3/sysext/core/Classes/Resource/ResourceFactory.php
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Resource;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -691,12 +690,4 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     {
         return GeneralUtility::makeInstance(Index\Indexer::class, $storage);
     }
-
-    /**
-     * @return DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/core/Classes/Resource/ResourceStorage.php b/typo3/sysext/core/Classes/Resource/ResourceStorage.php
index eaa191da51fdab6c520bc74d4c1d0beccec9c926..c2fddce139fb8afcaa09fb40cd9ee6b17eb13656 100644
--- a/typo3/sysext/core/Classes/Resource/ResourceStorage.php
+++ b/typo3/sysext/core/Classes/Resource/ResourceStorage.php
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Core\Resource;
  */
 
 use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Resource\Exception\InvalidTargetFolderException;
 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
@@ -2999,12 +2998,4 @@ class ResourceStorage implements ResourceStorageInterface
     {
         return $this->isDefault;
     }
-
-    /**
-     * @return DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-78224-TYPO3_DBOccurrences.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-78224-TYPO3_DBOccurrences.rst
new file mode 100644
index 0000000000000000000000000000000000000000..79cfceb8c0fd65296ac07aeb7abfaa5bd11d07f4
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-78224-TYPO3_DBOccurrences.rst
@@ -0,0 +1,40 @@
+.. include:: ../../Includes.txt
+
+==========================================
+Deprecation: #78224 - TYPO3_DB occurrences
+==========================================
+
+See :forge:`78224`
+
+Description
+===========
+
+The TYPO3_DB shorthand functionality has been removed for most of the TYPO3 Core PHP classes, excepted for the following locations:
+
+* AbstractPlugin->databaseConnection (protected property)
+* AbstractFunctionModule::getDatabaseConnection()
+* BaseScriptClass::getDatabaseConnection()
+
+For these occurrences extensions might extend the base functionality (e.g. for plugins or modules) and the call to the property and
+protected methods still work.
+
+Calling `$GLOBALS[TYPO3_DB]` is still possible but discouraged.
+
+
+Impact
+======
+
+Calling any of the methods above will trigger a deprecation log entry.
+
+
+Affected Installations
+======================
+
+Any TYPO3 instances with references to TYPO3_DB or references to the occurrences mentioned above.
+
+
+Migration
+=========
+
+Use the ConnectionPool and the QueryBuilder classes to achieve future-proof and proper database abstraction for future TYPO3
+versions.
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
index 0e2c1f5e1644630307adff98774c272e9ee10d59..599ecbf03eb830b5d7c51d8ff1f46f014f90b13e 100644
--- a/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
+++ b/typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Core\Tests\Unit\DataHandler;
  */
 
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Tests\AccessibleObjectInterface;
 use TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\AllowAccessHookFixture;
@@ -42,11 +41,6 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     protected $backEndUser;
 
-    /**
-     * @var DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $mockDatabaseConnection;
-
     /**
      * Set up the tests
      */
@@ -55,8 +49,6 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $GLOBALS['TCA'] = [];
         $this->singletonInstances = GeneralUtility::getSingletonInstances();
         $this->backEndUser = $this->createMock(BackendUserAuthentication::class);
-        $this->mockDatabaseConnection = $this->createMock(DatabaseConnection::class);
-        $GLOBALS['TYPO3_DB'] = $this->mockDatabaseConnection;
         $this->subject = $this->getAccessibleMock(DataHandler::class, ['dummy']);
         $this->subject->start([], '', $this->backEndUser);
     }
@@ -275,7 +267,6 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function inputValueCheckDoesNotCallGetDateTimeFormatsForNonDatetimeFields($tcaFieldConf)
     {
-        $this->mockDatabaseConnection->expects($this->never())->method('getDateTimeFormats');
         $this->subject->_call('checkValueForInput', '', $tcaFieldConf, '', 0, 0, '');
     }
 
diff --git a/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php b/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php
index 12087a8fbbae3fa6371bca549e9eb893ae8b725a..2cf9c8381385eec38d237ade75e7b338b7cad535 100644
--- a/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php
+++ b/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Database\Query\Restriction\FrontendRestrictionContainer;
 use TYPO3\CMS\Frontend\Page\PageRepository;
 
@@ -171,14 +170,8 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase
         $typoScriptFrontendController->gr_list = $feGroupList;
         $typoScriptFrontendController->sys_page = $pageRepository;
 
-        $dbMock = $this->getMockBuilder(DatabaseConnection::class)
-            ->setMethods(['quoteStr'])
-            ->getMock();
-        $dbMock->expects($this->any())->method('quoteStr')->willReturnArgument(0);
-
         $GLOBALS['TSFE'] = $typoScriptFrontendController;
         $GLOBALS['SIM_ACCESS_TIME'] = 42;
-        $GLOBALS['TYPO3_DB'] = $dbMock;
 
         $subject = new FrontendRestrictionContainer();
         $expression = $subject->buildExpression([$tableName => ''], $this->expressionBuilder);
diff --git a/typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php b/typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php
index ea9e90d22e44de63ce70aef512536904b2199067..509036a1fa9fe2cec1e92dedf106171361748992 100644
--- a/typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php
+++ b/typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php
@@ -320,7 +320,7 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
     /**
      * Sets current_version = 1 for all extensions where the extension version is maximal.
      *
-     * For performance reasons, the "native" TYPO3_DB is used here directly.
+     * For performance reasons, the "native" database connection is used here directly.
      *
      * @param int $repositoryUid
      * @return void
diff --git a/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php b/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
index f08f7929a298e33609bb8c155ce28662b13e1c6e..5beccb2ea46f3b71daa1cbf4d51f405143f8ab06 100644
--- a/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
+++ b/typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
@@ -718,12 +718,4 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface
     {
         $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionFileImport', [$destinationAbsolutePath, $this]);
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/feedit/Classes/FrontendEditPanel.php b/typo3/sysext/feedit/Classes/FrontendEditPanel.php
index ee15e693530139347f9828b7aad09e9fbb94adae..9cda05037666e77a299ba374365a6a7410e7cbe2 100644
--- a/typo3/sysext/feedit/Classes/FrontendEditPanel.php
+++ b/typo3/sysext/feedit/Classes/FrontendEditPanel.php
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Feedit;
  */
 use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
@@ -45,13 +44,6 @@ class FrontendEditPanel
      */
     protected $frontendController;
 
-    /**
-     * Property for accessing DatabaseConnection centrally
-     *
-     * @var DatabaseConnection
-     */
-    protected $databaseConnection;
-
     /**
      * @var FrontendBackendUserAuthentication
      */
@@ -65,13 +57,12 @@ class FrontendEditPanel
     /**
      * Constructor for the edit panel
      *
-     * @param DatabaseConnection $databaseConnection
+     * @param mixed $_ Previous the database connection
      * @param TypoScriptFrontendController $frontendController
      * @param FrontendBackendUserAuthentication $backendUser
      */
-    public function __construct(DatabaseConnection $databaseConnection = null, TypoScriptFrontendController $frontendController = null, FrontendBackendUserAuthentication $backendUser = null)
+    public function __construct($_ = null, TypoScriptFrontendController $frontendController = null, FrontendBackendUserAuthentication $backendUser = null)
     {
-        $this->databaseConnection = $databaseConnection ?: $GLOBALS['TYPO3_DB'];
         $this->frontendController = $frontendController ?: $GLOBALS['TSFE'];
         $this->backendUser = $backendUser ?: $GLOBALS['BE_USER'];
         $this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
diff --git a/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php b/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php
index f01c19fba46d3d1502f37238ccfcdb0292e78a2a..5bd8c96ad660e7ae72a2596fb6eb7ee13918f7f3 100644
--- a/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php
+++ b/typo3/sysext/frontend/Classes/Category/Collection/CategoryCollection.php
@@ -176,14 +176,4 @@ class CategoryCollection extends \TYPO3\CMS\Core\Category\Collection\CategoryCol
     {
         return $GLOBALS['TSFE'];
     }
-
-    /**
-     * Returns the database connection
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected static function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
index d210d8f3b4e084bef46aa4907400537fe03c0541..cf962e462f3d007daf43ff04e6d8e1c85d2a61a7 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
@@ -14,7 +14,6 @@ namespace TYPO3\CMS\Frontend\ContentObject;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
@@ -134,16 +133,6 @@ class ContentContentObject extends AbstractContentObject
         return $theValue;
     }
 
-    /**
-     * Returns the database connection
-     *
-     * @return DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
     /**
      * Returns the frontend controller
      *
diff --git a/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php b/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php
index 56477a76e63e5a459a0d99e02011187eb0a11c63..96fea2a99390f9cf37430e7f2405b25e7041dddf 100644
--- a/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php
+++ b/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php
@@ -229,6 +229,7 @@ class AbstractPlugin
      * Property for accessing DatabaseConnection centrally
      *
      * @var DatabaseConnection
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, use the Doctrine DBAL layer via the ConnectionPool class
      */
     protected $databaseConnection;
 
@@ -237,7 +238,7 @@ class AbstractPlugin
      * Initializes $this->piVars if $this->prefixId is set to any value
      * Will also set $this->LLkey based on the config.language setting.
      *
-     * @param DatabaseConnection $databaseConnection
+     * @param DatabaseConnection $databaseConnection, deprecated in TYPO3 v8, will be removed in TYPO3 v9
      * @param TypoScriptFrontendController $frontendController
      */
     public function __construct(DatabaseConnection $databaseConnection = null, TypoScriptFrontendController $frontendController = null)
diff --git a/typo3/sysext/frontend/Classes/View/AdminPanelView.php b/typo3/sysext/frontend/Classes/View/AdminPanelView.php
index eaafce3775f5b69a4bb5297e6f738ca1fb32ebd5..f2383aa5939cded7164ec3f337dea9890afd448e 100644
--- a/typo3/sysext/frontend/Classes/View/AdminPanelView.php
+++ b/typo3/sysext/frontend/Classes/View/AdminPanelView.php
@@ -789,16 +789,6 @@ class AdminPanelView
         return $GLOBALS['BE_USER'];
     }
 
-    /**
-     * Returns the database connection
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
     /**
      * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
      */
diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php b/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
index 2112cf88e6e25882c82096799c9a4725aa0ce7f6..f2fbc3ca5fda43c0d4d2d0eb92bf5275f2f6d038 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
@@ -302,9 +302,6 @@ class CleanUp extends Action\AbstractAction
      */
     protected function clearProcessedFiles()
     {
-        // make the DB available
-        $GLOBALS['TYPO3_DB'] = $this->getDatabaseConnection();
-
         $repository = GeneralUtility::makeInstance(ProcessedFileRepository::class);
         $failedDeletions = $repository->removeAll();
         if ($failedDeletions) {
diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php b/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php
index 82e1b6f458a199f822ff9286369f8aa269c99043..2b81cccd3dfd3b5e744a94bb683050c822bca7d1 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php
@@ -223,7 +223,6 @@ class TestSetup extends Action\AbstractAction
      */
     protected function convertImageFormatsToJpg()
     {
-        $this->setUpDatabaseConnectionMock();
         $imageProcessor = $this->initializeImageProcessor();
         $parseTimeStart = GeneralUtility::milliseconds();
 
@@ -266,7 +265,6 @@ class TestSetup extends Action\AbstractAction
      */
     protected function writeGifAndPng()
     {
-        $this->setUpDatabaseConnectionMock();
         $imageProcessor = $this->initializeImageProcessor();
         $parseTimeStart = GeneralUtility::milliseconds();
 
@@ -332,7 +330,6 @@ class TestSetup extends Action\AbstractAction
      */
     protected function scaleImages()
     {
-        $this->setUpDatabaseConnectionMock();
         $imageProcessor = $this->initializeImageProcessor();
         $parseTimeStart = GeneralUtility::milliseconds();
 
@@ -392,7 +389,6 @@ class TestSetup extends Action\AbstractAction
      */
     protected function combineImages()
     {
-        $this->setUpDatabaseConnectionMock();
         $imageProcessor = $this->initializeImageProcessor();
         $parseTimeStart = GeneralUtility::milliseconds();
 
@@ -445,7 +441,6 @@ class TestSetup extends Action\AbstractAction
      */
     protected function gdlib()
     {
-        $this->setUpDatabaseConnectionMock();
         $imageProcessor = $this->initializeImageProcessor();
         $parseTimeStart = GeneralUtility::milliseconds();
         $gifOrPng = $imageProcessor->gifExtension;
@@ -696,16 +691,4 @@ class TestSetup extends Action\AbstractAction
         list($version) = explode(' ', trim($version));
         return trim($version);
     }
-
-    /**
-     * Instantiate a dummy instance for $GLOBALS['TYPO3_DB'] to
-     * prevent real database calls
-     *
-     * @return void
-     */
-    protected function setUpDatabaseConnectionMock()
-    {
-        $database = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Database\DatabaseConnectionMock::class);
-        $GLOBALS['TYPO3_DB'] = $database;
-    }
 }
diff --git a/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php b/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
index 4b219e28bc2aa28df560f973594036e0dc018843..8b9a0c5eedd64227eb76347034cba82aad0edaf2 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
@@ -325,16 +325,4 @@ class UpgradeWizard extends Action\AbstractAction
         $schemaMigrationService = GeneralUtility::makeInstance(SchemaMigrator::class);
         $schemaMigrationService->install($createTableStatements);
     }
-
-    /**
-     * Overwrite getDatabase method of abstract!
-     *
-     * Returns $GLOBALS['TYPO3_DB'] directly, since this global is instantiated properly in update wizards
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/install/Classes/Database/DatabaseConnectionMock.php b/typo3/sysext/install/Classes/Database/DatabaseConnectionMock.php
deleted file mode 100644
index 1803cbef5a9a2b630a7d8d642c8acbdb29312793..0000000000000000000000000000000000000000
--- a/typo3/sysext/install/Classes/Database/DatabaseConnectionMock.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-namespace TYPO3\CMS\Install\Database;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * A "mock" to suppress database calls on $GLOBALS['TYPO3_DB'].
- * Used in TestSetup install tool action to prevent caching in \TYPO3\CMS\Core\Imaging\GraphicalFunctions
- */
-class DatabaseConnectionMock
-{
-    /**
-     * Get single row mock
-     *
-     * @return NULL
-     */
-    public function exec_SELECTgetSingleRow()
-    {
-        return null;
-    }
-
-    /**
-     * Insert row mock
-     *
-     * @return bool TRUE
-     */
-    public function exec_INSERTquery()
-    {
-        return true;
-    }
-
-    /**
-     * Quote string mock
-     *
-     * @param string $string
-     * @return string
-     */
-    public function fullQuoteStr($string)
-    {
-        return $string;
-    }
-
-    /**
-     * Error mock
-     *
-     * @return string Empty string
-     */
-    public function sql_error()
-    {
-        return '';
-    }
-}
diff --git a/typo3/sysext/sys_action/Classes/ActionTask.php b/typo3/sysext/sys_action/Classes/ActionTask.php
index f6631ac750f5639120d16d07f09a17909fdd3cfa..fe2cbda457243f5bda368a6a296980608657af56 100644
--- a/typo3/sysext/sys_action/Classes/ActionTask.php
+++ b/typo3/sysext/sys_action/Classes/ActionTask.php
@@ -1053,14 +1053,4 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface
     {
         return $GLOBALS['BE_USER'];
     }
-
-    /**
-     * Returns the database connection
-     *
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }
diff --git a/typo3/sysext/workspaces/Classes/Domain/Record/AbstractRecord.php b/typo3/sysext/workspaces/Classes/Domain/Record/AbstractRecord.php
index b29e1edbb7d9c65f417fa9774734597404f8d9a3..65b59fa36eb2b8225fc704328f60e753cd05c5f0 100644
--- a/typo3/sysext/workspaces/Classes/Domain/Record/AbstractRecord.php
+++ b/typo3/sysext/workspaces/Classes/Domain/Record/AbstractRecord.php
@@ -44,14 +44,6 @@ abstract class AbstractRecord
         return $record;
     }
 
-    /**
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected static function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
     /**
      * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
      */
diff --git a/typo3/sysext/workspaces/Classes/ExtDirect/ExtDirectServer.php b/typo3/sysext/workspaces/Classes/ExtDirect/ExtDirectServer.php
index d623eaf01addb5dc906390b1a75093f332beabe9..3a17da79ae8e291d0b9415ec7c0037c8cc7cd5af 100644
--- a/typo3/sysext/workspaces/Classes/ExtDirect/ExtDirectServer.php
+++ b/typo3/sysext/workspaces/Classes/ExtDirect/ExtDirectServer.php
@@ -18,7 +18,6 @@ use TYPO3\CMS\Backend\Backend\Avatar\Avatar;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Html\RteHtmlParser;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
@@ -456,14 +455,6 @@ class ExtDirectServer extends AbstractHandler
         return $GLOBALS['LANG'];
     }
 
-    /**
-     * @return DatabaseConnection;
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
-
     /**
      * Gets the Grid Data Service.
      *
diff --git a/typo3/sysext/workspaces/Classes/Service/StagesService.php b/typo3/sysext/workspaces/Classes/Service/StagesService.php
index beaefabd7789632569137279cef099f6ffe59c60..4fcafb785de1944d4f23861f6ff2537f7996c14e 100644
--- a/typo3/sysext/workspaces/Classes/Service/StagesService.php
+++ b/typo3/sysext/workspaces/Classes/Service/StagesService.php
@@ -789,12 +789,4 @@ class StagesService implements \TYPO3\CMS\Core\SingletonInterface
     {
         return $GLOBALS['BE_USER'];
     }
-
-    /**
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
-     */
-    protected function getDatabaseConnection()
-    {
-        return $GLOBALS['TYPO3_DB'];
-    }
 }