You will surely get an error if the name doesn't match. At least you'll see "Cannot connect to xyz" or s.th. similar.
Use a config file to store all DB credentials.
I'd suggest you start reading here:
Managing Application Settings[
^]
regards
Michel