You cannot simply modify wp-config.php to point at multiple databases
Yes you can. It's PHP.
Psudeocode follows:
IF domain == domain.com
{ db prefix = wp_foobar_ ; db name = domain.om_sql}
And on and on :) It's basic PHP if/then checks on the domain name.