Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 sqlcmd starting error

Author  Topic 

mahajanakhil1985
Yak Posting Veteran

71 Posts

Posted - 2010-02-05 : 07:16:28
I am receiving the following error while starting SQLCMD.

C:\>sqlcmd
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 establishing a connection to the server. When connecting to SQL Ser
ver 2005, this failure 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.


Following this, I navigated to SQL Server 2005 Surface Area Configuration-> Surface Area Configuration for Services and Connections->Database Engine->Remote Connections. Then I clicked on Local and Remote Connections and then Using both TCP/IP and named pipes. Then apply and restarted the SQL SERVER Service.
Then again same error when tried to create SQLCMD session. Am I missing to do some other configuration?


webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-02-05 : 07:22:01
You should show the statement...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

mahajanakhil1985
Yak Posting Veteran

71 Posts

Posted - 2010-02-05 : 11:11:39
Which statement are you talking about? I have already mentioned everything.

I also tried to connect to Database Engine for a server named 'INST' as follows:

sqlcmd -S Inst -E
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-02-06 : 06:43:41
In your first post you did
C:\>sqlcmd

and your second post
sqlcmd -S Inst -E

both of these are incorrect

The way to make the connection is

sqlcmd -S MYSERVERNAME\MYINSTANCE -E

Only use -E switch if you are using Windows Authentication otherwise use the -U -P switches
for sql server authentication


Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-02-06 : 16:48:41
http://weblogs.sqlteam.com/tarad/archive/2008/05/23/60609.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

mahajanakhil1985
Yak Posting Veteran

71 Posts

Posted - 2010-02-10 : 06:43:11
Sorry I forgot to update. Thanks, it worked.

Cheers!!!
Go to Top of Page
   

- Advertisement -