.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Can connect via SSMS but not SQLCMD/OSQL

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :Sql Server
I can connect to my SQL 2008 Express Edition server using SSMS.  I cannot connect using OSQL or SQLCMD and my application is having sporadic connection issues.  When I attempt to connect via OSQL, the following error is returned: Error: 18452, Severity: 14, State: 1.  Login failed.  The login is from an untrusted domain and cannot be used with windows authentication. The following are errors present in the SQL errorlog:  Error: 17806, Severity: 20, State: 2.  SSPI handshake failed with error code 0x8009030c while establishing a connection iwth integrated security; the connection has been closed. [CLIENT: <local machine>] Error: 18452, Severity: 14, State: 1.  Login failed.  The login is from an untrusted domain and cannot be used with windows authentication. I see an error in the application event log: Event 6037, LsaSrv  The program sqlservr.exe, with the assigned process ID 1788, could not authenticate locally by using the target name MSSQLSvc/{srvnm}.{workgrp}.net:{SQLinstancenm}.  The target name used is not valid.  A target anme should refer to one of the local computer names, for example, the DNS host name.  Try a different target name. Has anyone else experienced this issue - what else can I look into?      

View Complete Post

More Related Resource Links

SSMS and SQLCMD won't connect to valid SQL Instances


I have had Windows 7 for over a year now and a few months ago I was unable to connect to any SQL Server.  It worked at one time and I don't recall changing anything other than normal Windows updates.  What's really strange about this problem is that It just hangs.  If I put a valid SQL server it will hang and never throw an error.  NEVER.  It hangs indefinately.  If I put an invalid SQL server it will error out as it should.  I have spent 80 hours on this by now and am ready to re-install the operating system to see if it helps.  These are the things I have tried:

  • Uninstalling and re-installing SSMS
  • Used OSQL and SQLCMD to no avail
  • Disabling the firewall
  • Pinging the servers directly.  And I get a response.
  • Used the IP address of the server instead of the name
  • Disabling port 1433 on the firewall
  • I can create an ODBC connection to these instances
  • Begging and pleading with the PC


sqlcmd, cannot connect to server

I have SQL Server installed on a machine called SQLDEV. I log on to that machine and I run the command sqlcmd -s SQLDEV -Q "select * from <db>.<schema>.<some_table> -E This command works and returns a result set.   Next, I go to a different machine. On that machine I can use SQL Mgmt Studio to log on to SQLDEV using window authentication. However, if I run the same command as above, I get some kind of a connection error. The error says, ".... When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections .....   Any suggestions/ideas why I am getting this error?

Cannot connect to SSRS from SSMS

I have an SSRS 2008R2 server with Forms Authentication (ie a custom security module). It's all setup, configured, running, and I can report on it fine. What I can't do is use SSMS to connect to the SSRS to configure ROLES etc. It reports: The username or password is not valid or you do not have permission to access this server. (Microsoft.SqlServer.Management.UI.RSClient) If I click on additional information I can see: Program Location:    at Microsoft.SqlServer.Management.UI.RSClient.RSClientConnection.CreateConnection()    at Microsoft.SqlServer.Management.UI.RSClient.RSConnectionInfo.GetRSConnectionObject(Boolean ensureOpenConnection)    at Microsoft.SqlServer.Management.UI.RSClient.RSConnectionInfo.RSTypeImpl.ProceedWithConnection(UIConnectionInfo ci)    at Microsoft.SqlServer.Management.UI.ConnectionDlg.RSType.Microsoft.SqlServer.Management.UI.ConnectionDlg.IServerType.ProceedWithConnection(UIConnectionInfo ci)    at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()   And if I look in the report server logs, I can see the following error:   library!ReportServer_0-10!eb0!09/15/2010-17:41:28:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.SecureConnectionRequiredException: , Microsoft.ReportingServices.Diagnostics.Utilities.SecureConnectionRequiredException:

Cannot connect to Reporting Services in SSMS using Servername



Kindly help me as i can't connect to Reporting Services in SSMS using SERVERNAME but using URL(http://localhost/ReportServer) I can connect. Here is the error I received. Please advice.

TITLE: Connect to Server

Cannot connect to PERRYDUNDOC-W7.


Unable to connect to the server at SERVERNAME. The specified URL might not be valid or there might be a problem with the report server version or configuration. Specify a different URL, or contact your server administrator to verify that the report server runs SQL Server 2008 or later. Additionally, if you are trying to connect to a SharePoint-integrated report server, verify that SharePoint is installed on the server and that the report server uses SharePoint integrated mode. (Microsoft.SqlServer.Management.UI.RSClient)




SSMS - Connect to Server dialog box - server history not showing


When I invoke SSMS, the "Connect to Sever" dialog box comes up.  Under the "Server Name" dropdown, it only displays a maximun of history entries (previously used connections/servers).  On other machines, it shows 10-15 previously used servers.

Does anyone know what I need to do or what needs to be configured on my machine to allow it to store my history entries?  If I connect to a new server, then one of the existing gets dropped off.  Just got tired of entering server names here...

Thank you very much.

Connect SQL Server 2005 SSMS to SQL Server 2008


is it ok to connect to sql server2008 server form sql server 2005 management studio. If yes, can you please let me know what should i do ?

InfoPath 2010 cannot connect to SharePoint 2010

You have installed Office 2010 beta and you are trying to connect to SharePoint 2010 from InfoPath but you get an error

could somebody give me example how I can connect to database only once if I use many models in contr


I use in my ASP.NET MVC application repository pattern and I use in controller for example 3 models:

   namespace MvcApplication1.Controllers  
        public class HomepageController : Controller  
            private IWebsitesRepository _repository_websites = new WebsitesRepository();  
            private IFirmRepository _repository_firm = new FirmRepository();  
            private IPhotosRepository _repository_photos = new PhotosRepository();  

In WebsiteRepozitory, FirmRepository and PhotosRepository classes I have:

Database1Entities _entities = new Database1Entities();

So I have 3 connections to database ? Is it wrong ? How can I solve it ?

SAAS: Connect Enterprise Apps with Hosted BizTalk Services


In this article we introduce you to BizTalk Services, new technology that offers the Enterprise Service Bus features of BizTalk Server as a hosted service.

Jon Flanders and Aaron Skonnard

MSDN Magazine June 2008

Interop: Connect To Mainframe Apps With BizTalk Adapters and .NET


If you have a significant investment in legacy COBOL applications running on mainframes, you need the BizTalk Adapters for Host Integration Server .

Bashar "Bash" Badawi

MSDN Magazine December 2007

ASP.Net connect to Oracle.


 We have an application which uses  'System.Data.OracleClient'. On the box it was developed we can change the TNSNAMES.ORA entries to connect to different oracle databases. Moving the code to a  Microsoft Server 2008 box it would appear that the application ignores the TNSNAMES.ORA file. It has cached the first Oracle connection and will now work without any TNSNAMES.ORA file. Where is it getting the connection? We have set tns_admin to point at the TNSNAMES.ORA file. We can tnsping the connection OK.

Facebook Connect


Does anybody have links to relevant articles on how Facebook Connect integrates with the Membership provider?

I'd like to make a .net site where you can login through the membership provider, or the Facebook Connect system.  But the big question is, how does your asp.net application know when the Facebook authentication has been successful.  Without manually entering a username and password, is there a function to authenticate users and draw the profile info from Facebook's data?

It seems like a good system, but the documentation is sparse.

unable to connect to database



I am using visual studio 2005 and sql server 2005.

I am developing a small quiz application and i have stored the connection string in app.config file which is given below.:

<?xml version="1.0" encoding="utf-8" ?>
        <add name="quizdb"
            connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Quiz Application.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
            providerName="System.Data.SqlClient" />
i have retrieved connection string property through configurationmanager class 

and when i m connecting to database  it gives me a runtime error:


Sql Exception was unhandled

System.Data.SqlClient.SqlException was unhandled
  Message="An attempt to attach an auto-named database for file F:\\Quiz\\Quiz\\bin\\Debug\\Quiz Application.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located

Connect to existing sql 2005 database


Hello There,

I had successfully restored sql 2000 database to sql 2005. It works like charm

Now i am creating a database model in MVC

I follow these steps

Right click on model > ADO.NET entity data model > Generate from database > New connection (Microsoft sql server) > server name > select or enter database name

But no server name AND database name show in both drop down lists. When i mannually enter database name (which exists in sql 2005) then click on TEST CONNECTION. It gives follwoing error

"A network-related or instance-specific error while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections.

Kindly help me with this


Basic ODBC Connection to connect to Crystal ???


I have visual studio 2008 professional with the inbuilt crystal reports version 10 I think.  I create everything from my laptop and IIS runs from my laptop as well.

I have created the most basic report to try and figure out a problem I have, anyways the report contains one database field that is it .... which I connect to by ODBC.  I then create a web form add the crystal report viewer to the report and the crystal report source run the web page and it loads the data from the field as I would expect to the crystal report viewer !!

I have several ODBC connections setup on my machine one using integrated security the other using SQL authentication both are system DSNs.  Now when I publish my application and access it from IIS and not the localhost I can access everything from my application ok except when I go to form that has the crystal reports I get this error (ODBC used here is the 'sa' account)

Logon failed. Details: IM002:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Error in File

If I use the other ODBC that uses Windows authentication I get this error message

Logon failed. Details: 42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database  requested by the login. T

Enter your credentials to connect to the web service


When trying to publish an InfoPath 2007 form template (as a Content Type), I am getting the following message with a UserName/Password dialog box:
Enter your credentials to connect to the following web service: http://MySitePath/_vti_bin/Webs.asmx

When I enter my credentials, the above dialog box appears again. I have carefully entered my credential. Another thing I noticed that despite this error I see the form got created at the destination library. The only thing is that the Content Type did not get created and hence is not available in the "Site Content Type Gallery".

We are using Sharepoint 2007 enterprise edition. And I have recently published the InfoPath form templates several time as Content type without any issue.


Please help. Thanks........

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend