You receive a "Cannot connect to the configuration database" error message when you connect to your Windows SharePoint Services Web site

I found something interesting this morning while working with STSADM.EXE to verify the installation of a web part package on Sharepoint Portal using the -enumwppacks command.

Every time I ran stsadm, I received the following error message:

Cannot connect to the configuration database. For tips on troubleshooting this error, search for article 823287 in the Microsoft Knowledge Base at http://support.microsoft.com.

So, I went and verified that all of the settings as specified in the article, mostly dealing with the application pool user and the database rights for that user. All seemed to be in order so I really couldn't figure out what was happening.

THEN I got to thinking about the fact that MAYBE, the information in the article was correct, but the context was not.

I was logged onto the server as a "development" user which doesn't actually have God-like powers to things. It also didn't have total access to the database either, I found.

So in a nutshell, here is the situation: when using stsadm on the command line, you are running under the security context of the currently logged-on user. That user must have proper access to the database in order for the command-line utilities to function as designed.

This is not a problem when performing administrative functions via the SPS/WSS web interfaces because at that point, you're running under the security context of the web site's Application Pool user.

Anyway, this was an interesting learning experience.