Yes I am using mysql, and what you suggest works in a .htaccess file, but another user will still be able to read the .htaccess file I think.
My host uses plesk to setup the database and I'd hoped that it would have set the values for me in the main Apache config files, but no, it doesn't.
At least, using the .htaccess file gets the passwords out of the php scripts, which is an improvement.
Thanks, Ian