Query table in a different database I'm writing another plugin for my craft app, this time I'm attempting to reuse a MySQL table that's used by other applications as well. I've a class extending the BaseRecord, and getTableName() will return differentdb.tablename. Does Craft handle this, or do I have to make a copy of that table in the craft database? (MySQL permissions for the craft user already give it read access to that database)
Have you tried it? I'm pretty sure that's not going to work as Active Record is tied to the db connection in craft/config/db.php hanging off of craft()-&gt;db.

You should be able to pull it off with a plugin that instantiates its own DbConnection, though and uses Query Builder instead of Active Record.  Completely untested, but something like this:

$otherDbConnection =  Craft::createComponent(array(
    'emulatePrepare'    =&gt; true,
    'charset'           =&gt; 'utf8',
    'tablePrefix'       =&gt; 'craft_',
    'class'             =&gt; 'Craft\DbConnection',
    'autoConnect'       =&gt; true,
));

$otherDbConnection-&gt;connectionString = 'mysql:host=localhost;dbname=otherdb;port=3306';
$otherDbConnection-&gt;username = $userName;
$otherDbConnection-&gt;password = $password;


From there you can do $otherDbConnection-&gt;createCommand() and grab all of the data you want from the other database.  It's up to you how you'd merge that in with data from your existing database.

If you wanted to get fancy and access the database in other files/places in code, you could do:

craft()-&gt;setComponent('otherDb', $otherDbConnection);


And access the other database via: craft()-&gt;otherDb-&gt;createCommand().