This is not a simple subject - it gets to be extremely complicated, very, very quickly.
The problem is that getting info from a remote DB is easy - but databases aren't static things, they get updated. And the main reason for adding a local database is so that the local copy can be used "offline" - and what happens to data that is updated on the local DB? Should it be updated on the remote DB as well? And what if someone else also updated the same data - which one should "win"?
This is a problem called Database Replication and you need to think long and hard before you leap into it: your DB(s) must be designed very carefully and specific rules established before you even start trying to code.
Have a read here:
Replication (computing) - Wikipedia[
^] and then follow a few links:
Database Replication - Google Search[
^]
database replication and reconciliation[
^]