JDATABASE-CLASS-001
JDatabase
JDatabase class name
JDatabase is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JDatabase" not found.
JDatabase → Joomla\Database\DatabaseDriver
What you will see
- Class "JDatabase" not found
- Class 'JDatabase' not found
- Failed to open stream: JDatabase
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JDatabase for Joomla\Database\DatabaseDriver.
Joomla 3
Remove or stop calling this
JDatabase::getInstance();
// or new JDatabase()Joomla 4 / 6
Use this instead
use Joomla\Database\DatabaseDriver;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\Database\DatabaseDriver.
- 2Replace every JDatabase with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JDatabase · Joomla\Database\DatabaseDriver · class alias · J prefix
Related issues
- Joomla 3 → 4PHP
DS path constant
DS → DIRECTORY_SEPARATOR or /
- Joomla 3 → 4Events / plugins
JDispatcher / JEventDispatcher
JDispatcher::getInstance() → Event dispatcher + SubscriberInterface
- Joomla 5 → 6Database API
Factory::getDbo() / getDBO()
JFactory::getDbo() → $this->getDatabase() or Factory::getContainer()->get(DatabaseInterface::class)
- Joomla 4 → 5PHP
Dynamic PHP properties (PHP 8.2+)
$this->foo = 1 on an untyped class → Declare the property or use AllowDynamicProperties
- Joomla 3 → 4Database API
Old $db->query() API
$db->query() → $db->execute() / loadObjectList()
- Joomla 3 → 4Manifest / installer
Joomla 1.5 plugin folder / discover install
plugins/content/foo.php (1.5 layout) → plugins/content/foo/foo.php + foo.xml (1.6+ layout)