Getting an error "Unable to connect to database" on MOSS site

Check if you have a dll called Security.dll in your bin folder of MOSS.

Why does it fail?

We have Security.dll which comes with OS and it is required for authentication purposes between server and client.

When we have Security.dll in bin folder of MOSS, IIS Loads this dll and assumes this as the dll which is required for Authentication. As it cannot find the appropriate method and properties the authentication fails and the error is thrown