Using Database Connection

Sorry Jim it's really unclear what your workflow is. Your posts are confusing and we can't understand what exactly are you doing.

The workflow for defining database connections per different targets in your site is quite simple:

You do that once only and then when your target is switched, it uses the connection defined for it.