BUG: SQLDMO - Query Analyzer May Fail to Connect if SQL Server Is Started as Part of Connection Attempt (234736)



The information in this article applies to:

  • Microsoft SQL Server 7.0
  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q234736
BUG #: 55818 (SQLBUG_70)

SYMPTOMS

If SQL Server is started from Query Analyzer with the option "Start SQL Server if stopped", the connection may fail. The error that occurs is:
Unable to connect to server 'server name'
Server:Msg 6, Level 16, State 1
[Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL Server not found.
Similarly, from a SQL Distributed Management Objects (DMO) program when Start is used with StartMode = TRUE to make a connection after a successful start, it may fail with this error:
Runtime error '-2147221504' ( 80040000 )
[Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL Server not found.
[Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionOpen(CreateFile( )).

CAUSE

If SQL Server needs to create or relocate a large .mdf or .ldf file at startup (for example tempdb.mdf is deleted), the connection attempt is made before SQL Server is fully started resulting in the error.

WORKAROUND

Attempt the connection again from Query Analyzer.

For SQL Distributed Management Objects (DMO) applications do not use StartMode = TRUE. Instead try connecting after SQL Server is started.

Sample code:
With HostSQLServer
    
  If Not .VerifyConnection(SQLDMO.SQLDMOConn_CurrentState) Then
            
    If .LoginSecure Then
      .Connect .Name
    Else
      .Connect .Name, .Login, .Password
    End If
  End If

End With
				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Modification Type:MajorLast Reviewed:10/16/2003
Keywords:kbBug kbpending KB234736