One shouldn't even have to mess with $db_url . I have a bunch of modules which use db_set_active() successfully in Drupal 4.7 and none touch $db_url. Most of my code looks something like this:
$previousdb = db_set_active('mydb'); $result = pager_query($sql, $limit, 0, NULL); // handle results db_set_active($previousdb);
Morbus, are you finding that your code doesn't function correctly without tweaking the global $db_url? Seems like something might be broken, if so.