I need to my portal that I'm building to be able to integrate with an existing system. The portal just have to pull data from the system database so that any update made from the system, the portal will also receive an update.

I have read this:

http://docs.joomla.org/Selecting_data_using_JDatabase

http://docs.joomla.org/Connecting_to_an_external_database

and https://stackoverflow.com/questions/15441065/joomla-using-multiple-database-queries-in-one-function

However I still could not get the idea on where to start first. I mean, which php file inside Joomla 3.x that I should modify?

Is there a better & simpler explanation as I'm too bad understanding a complex explanation

You have found specific articles for the question about Joomla opening an external connection.

Now, your next question is how to extend Joomla. If you are need to create a whole set of new features, for instance, browsing external tables in your site, then you have to create a Component. If you only have to display a list of entries in a position, you can simply create a Module.

Developers - Getting Started http://docs.joomla.org/Portal:Developers

If you wish to connect to an external data source (a different database than the one your Joomla site is using), And you have control over your component or module, You should modify the model that receives the data an instead of using

$db = JFactory::getDbo();

Initiate a new connection like so:

$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 );

and process the received data just like any other model data.

Hope it helps

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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