CiviMail DB Error: no database selected
In all of your database changes, you may have mixed up the database information in one or the other of your civicrm.settings.php files.  In Joomla there are two:

administrator/components/com_civicrm/civicrm.settings.php


and

components/com_civicrm/civicrm.settings.php


They should be almost identical: the site URL for the one in administrator should be http://yoursite.org/administrator/ rather than just the base URL of your site.

Both have database connection information; so does your Joomla configuration.php file.  You need all three to agree on the Joomla database information (the line with CIVICRM_UF_DSN in the CiviCRM files), and you need the two CiviCRM files to agree on the CiviCRM database information (the line with CIVICRM_DSN).

If you think you've hopelessly ruined your CiviCRM settings files, you can rebuild them from the copy at

administrator/components/com_civicrm/civicrm/templates/CRM/common/civicrm.settings.php.template


You will want to keep your existing ones handy as a guide (and a fallback in case you cause trouble), and you'll need to replace all the tokens, which appear as %%tokenname%% in the file.