You must ask yourself the question: from whom do I want to protect the password?
As @Martin already said, sysadmin will always have access, and it should, because it is the one who supports the system. You cannot hide anything from the server administrator.
So, I would go with the configuration files. Anyone who sets up the database for your application will also set up the password (and username) for the database in the configuration file.
Just make sure that not everyone can read the configuration file, so that only privileged users can read the file, this is the best you can do.
Ortwin angermeier
source share