Not able to connect to SQL Server 2005 Express Server

Hi all,

I met a problem on SQL Express Server 2005.

After I installed it and set a database, I can not connect to the instance with the following command:

sqlcmd -s hostname.china.***.com\SQLEXPRESS

Following is the error msg:

****************************************************************************

HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi
shing a connection to the server. When connecting to SQL Server 2005, this failu
re may be caused by the fact that under the default settings SQL Server does not
allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

*****************************************************************************

I have enabled TCP/IP and name pipes and still failed.

One thing needs to be mentioned that I am using a statistic IP in my company and the machine name is together with a DNS suffix just as you see above (hostname.china.***.com)

I also want to connect to another machine which has SQL Express 2005 installed, but failed either.

What is strange is that these two machines can ping to each other with the full qualified name or short name. (ping hostname1 or ping hostname1.china.***.com)

Who can tell me what is the problem




Answer this question

Not able to connect to SQL Server 2005 Express Server

  • Kumar Mridesh

    hi. look i have the same error but i cannot even use the simple sqlcmd command. I am trying to import an sql file into the sql server manager but i do not know how, any suggestion , thank you very much.

    ************************************************************

    C:\Documents and Settings\Administrador>Sqlcmd
    HResultado 0x2, nivel 16, estado 1
    Proveedor de canalizaciones con nombre: No se pudo abrir una conexion con SQL Se
    rver [2].

    **************************

    pd. sorry for my bad english. Wink


  • Yeshia

    Thanks Peter. New to SQL server, and your tip about the lower case s sorted it.

  • Rajah

    First make sure that the sqlcmd uses capital '-S' instead of lower case '-s' since the options are case-sensitive; I saw cases where this caused a problem:

    sqlcmd -S hostname.china.***.com\SQLEXPRESS

    If the failures persist I suggest:

    (1) for local connections: use dot instead of the fully-qualified domain name:

    sqlcmd -S .\SQLEXPRESS

    (2) for remote connections: send the full error message as you did above, that should help a bit.



  • JWSUN

    Peter, thank you for your suggestion, it works on local database with dot instead of fully-qualified domain name. I need to mention that I use "sqlcmd" command via remote desk of windows, will that cause a problem

    The following is the detailed response of "sqlcmd" command:

    *** Trying to connect to remote database - localhost name: ovt39.china.***.com ***
    C:\>sqlcmd -S zyltestip01.china.***.com\SQLEXPRESS
    HResult 0xFFFFFFFF, Level 16, State 1
    SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
    Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi
    shing a connection to the server. When connecting to SQL Server 2005, this failu
    re may be caused by the fact that under the default settings SQL Server does not
     allow remote connections..
    Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

    ***This is the command response of the database on zyltestip01.china.***.com***
    C:\>sqlcmd -S .\SQLEXPRESS
    1>

    Here are the machine information:(*** is just and example)
    Host Name . . . . . . . . . . . . : zyltestip01
    Primary Dns Suffix  . . . . . . . : china.***.com



  • Not able to connect to SQL Server 2005 Express Server