Ambiguous errors: oledbconnection DB_SEC_E_AUTH_FAILED

A client rang to say they are having problems with a small program I wrote. It has worked for a few months – no problem, then out of the blue they started receiving an error “DB_SEC_E_AUTH_FAILED”. Initially thoughts were security changes or user permissions, so time was spent looking into server changes. (This was a Terminal Services environment). During the last week some 14 updates had been pushed out:

Figure: Installed Updates

Was it possible one of these was a culprit. Interestingly, another piece of our legacy software could still access the database, indicating the issue was related to the .NET application. It was time to trace some code.

The starting point was to log the filename passed into the connection method. Deploy. Test.

The result was simple. The filename passed in was BLANK ! So I immediately went to the registry, found the offending entry, and sure enough no filename. When this minor issue was corrected amazingly, everything went right back to working.

So the lessons learned:

1. Don’t forget to check the basics BEFORE you take any notice of the error
2. Add to knowledge base that Security and Authentication errors happen when you pass NO filename into a OleDBConnetion method.

Needless to say, we don’t know what caused the registry to be cleaned, the history of this particular server (which I do not administer) is another story for another day !