Connecting to Multiple Databases in Joomla Using JDatabase

It is possible to create connections to multiple databases using the JDatabase::getInstance() method. The following link points to a tutorial that describes how to create a helper file that makes it easy to create multiple JDatabase instances that point to different databases. You can create the database instances in the following manner using the custom helper class.


$db = JFactory::getDBO();
$db2 = MyDataHelper::getDBO2();
$db3 = MyDataHelper::getDBO3();

You can still get the default database object normally using JFactory.

The full tutorial on creating this helper is found here.

Leave a comment

0 Comments.

Leave a Reply


[ Ctrl + Enter ]