Using/switching between multiple databases


i am new to ruby on rails but have been doing fine so far. i am
porting/rewriting a webapp for use primarily on mobile devices,
particularly blackberries. anyway, the situation is that a user logs in
to a main database which contains password and login information to
several other databases wherein the actual client data is stored. i know
i could just define another database in the config file, but the new
database must be connected to dynamically, since i don’t want to store a
bunch of password and login info for all my other databases in a config
file if they’re not needed. any thoughts or opinions? i’m pretty much
stuck after my first week on the job, hahaha. thanks!