Tuesday, March 10, 2009

Error Fix: Server msg 18, level 16, state 1

Today I ran into one of those really annoying bugs, the kind you get right at the opportune moment you need the software to work and it doesn't.

This time I was trying to run my application that uses Microsoft's SQL Server 2000. I couldn't connect to the database for some reason.

From SQL Query Analyzer it said:

Unable to connect to server. Server msg 18, level 16, state 1. [Microsoft] [ODBC SQL Server Driver} [Shared Memory] SSL security error

From Enterprise Manager it said:

Unable to connect to server. Reason: SSL security error. ConnectionOpen (SECDoClientHandShake())...

Microsoft had a solution for the problem that said it was trying to use a certificate that wouldn't allow it to work. See: http://support.microsoft.com/kb/302409

However, that wasn't the solution I needed. After looking at some stuff for a while, I called my co-worker and he clued me into a possible solution.

We ran start->run application -> "MMC", then added a snap-in via File->Add/Remove Snap-in, click the button to add ..., then choose Certificate in the snap-in options. I chose Computer Account, then local computer, then it adds the snap in. Close the add form and the Add/Remove Snap-in form.

On the tree view of the MMC console - open Cerficates -> Personal -> Certificates. I had two certificates listed there. (remembering back when I did it, I accidentally created two when I ran selfssl.exe - a tool to create a development testing self signed certificate.) Apparently SQL Server has a tissy-fit when it finds more than one certificate.

I deleted one of the certificates after backing it up just in case I got the wrong one. Restarting my database server refreshed the certificate registration and did the trick. I'm up and running again. Grrr - I hate these one hour find a fix bugs that stop my flow of normal work, but thought I would put this down here so that others could perhaps benefit - even just myself when I do it again.