March 11, 2009 at 5:19 am
I'm trying to use sqlcmd, however, I'm getting the following error:
1st error...
C:\Program Files\Microsoft Visual Studio 9.0\VC>sqlcmd -d master -U sa -P passwo
rd
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.
So far I've checked that SQL Server browser service is running.
I've searched high and low going but found no solutions so far.
:w00t:
Related links:
http://www.codeproject.com/script/Forums/View.aspx?fid=1642&msg=2958694 - forum post
http://forums.asp.net/t/939300.aspx - 2nd error
March 11, 2009 at 7:44 am
Have you checked to make sure that the SQL Server has Named Pipes enabled? YOu can check this using the SQL Server Configuration Manager under Network Configuration.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
March 11, 2009 at 7:51 am
I enabled it, and, restarted the SQL Service and SQL Service Browser, but no joy.
March 11, 2009 at 8:02 am
Can you connect to the server using another application like SSMS?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
March 11, 2009 at 8:32 am
yep
March 13, 2009 at 8:34 am
Are you using trusted connection to login to the server? you can use -E if yes.
March 13, 2009 at 9:03 am
apat (3/13/2009)
Are you using trusted connection to login to the server? you can use -E if yes.
Still a time out error though...
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Jonathan>sqlcmd -E -d master
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.
C:\Documents and Settings\Jonathan>
March 13, 2009 at 9:13 am
Can you connect using tcp? You can force sqlcmd to connect using tcp like this:
sqlcmd -E -Stcp:yourservername[,port if not default]
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
March 13, 2009 at 10:04 am
Still no joy.
I also checked/updated the following, from SQL Server Configuration Manager:
SQL Server 2005 Network Configuration > Protocols for SQLEXPRESS
Shared Memory - Enabled
TCP/IP - Enabled (updated because it was disabled)
VIA - Disabled
SQL Native Client Configuration > Client Protocols
Shared Memory - Enabled
TCP/IP - Enabled
Named Pipes - Enabled
VIA - Disabled
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Jonathan>sqlcmd -E -Stcp:armani
HResult 0x274D, Level 16, State 1
TCP Provider: No connection could be made because the target machine actively re
fused it.
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.
C:\Documents and Settings\Jonathan>sqlcmd -E -Stcp:armani
HResult 0x274D, Level 16, State 1
TCP Provider: No connection could be made because the target machine actively re
fused it.
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.
March 13, 2009 at 10:13 am
Wait a minute, SQL Server Express? If you take the defaults when installing express it installs a named instance (typically SQLExpress) so you would need to do servername\instancename to connect to it. So try using -Slocalhost\SQLExpress
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
March 13, 2009 at 10:16 am
That worked thanks,
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Jonathan>sqlcmd -E -Stcp:armani -Slocalhost\SQLEXPRESS
1>
March 13, 2009 at 10:17 am
Thanks that worked.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Jonathan>sqlcmd -E -Stcp:armani -Slocalhost\SQLEXPRESS
1>
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply