In using the MySQL Database, here is the default query in populating lists:

$db = JFactory::getDbo(); 
$query = $db->getQuery(true); 
$query->select(array('name', 'email', 'username')) 
$row = $db->loadRow(); 

How can I configure which database I want to use? I need to get data from a different database which in my case, Oracle.

2 Answers 2


There is a file called configuration.php in root directory. Open that file, find:-

public $dbtype = 'mysqli';

change that value to:

 public $dbtype = 'oracle';

this will change database driver, list of drivers files can be found in:-

libraries/joomla/database/driver folder,

For more info see this article. Hope this helps.

Update - If you want to use only in some section then, instead of getting instance of database like

$db = JFactory::getDbo();

try :-

$db = JDatabaseDriver::getInstance($options);


$options = array('driver' => 'driver_name', 'host' => 'host', 'user' => 'user', 'password' => 'password', 'database' => 'db_name', 'prefix' => 'prefix');
  • thanks for your answer. However I don't plan to use Oracle in my whole application, just within a form. Jan 30, 2015 at 7:25
  • 2
    For that you can get instance of JDatabaseDriver, you can pass array of options here, with which driver you can use. For that please take a look at JDatabaseDriver class. [not tried though] Jan 30, 2015 at 7:30
  • do you know what is the driver used in oracle? i tried using 'driver' => 'oracle' but results with an error: Could not connect to PDO: could not find driver Jan 30, 2015 at 9:19
  • I have just tried to get instance of database, where JDatabaseDriverOracle Object is created. could you please show your tried code? Jan 30, 2015 at 9:22
  • please take a look at my update Feb 3, 2015 at 1:04

Joomla Docs is a nice documentation site ;-)

Connecting to an external database https://docs.joomla.org/How_to_connect_to_an_external_database

$option = array(); //prevent problems

$option['driver']   = 'mysql';            // Database driver name
$option['host']     = 'db.myhost.com';    // Database host name
$option['user']     = 'fredbloggs';       // User for database authentication
$option['password'] = 's9(39s£h[%dkFd';   // Password for database authentication
$option['database'] = 'bigdatabase';      // Database name
$option['prefix']   = 'abc_';             // Database prefix (may be empty)

$db = JDatabaseDriver::getInstance( $option );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.