So I'm really not a DBA, I'm an app dev.

I had to install my asp.net mvc3 app on my client's(a large company) IIS6 + Win2k3 machine, with absolutely no help from their sysadmins.

The final problem now is SQL Server 2008 r2, after figuring out how to create a login from windows, my app and sqlcmd.exe always complains it cannot find a sql server instance!!

I have all the sql services (in services.msc) running to Log On as the local system. I can login fine with SQL Server Management Studio with Windows Auth. I created my database, my asp.net app needs/uses windows auth.

But for the love of God, whatever I do my app always complains it cannot find the instance. (Also tried running SQL CMD and it complains of the same thing too!)

My data base connection string looks like this:

Data Source=machinename\username;Initial Catalog=myDataStore;Integrated Security=True;MultipleActiveResultSets=True

Machinename\user is the same thing that shows up on the sql server management studio login if I choose windows authentication right?

  • 1
    "no help from their sysadmins." -> why? If you installed SQL Server on my network you'd be escorted out – gbn Jan 16 '11 at 8:56
  • lol!, these guys are a little crazy! I was trying to explain to one of them he hasn't given my username permissions, he kept arguing with me, then I walk him through creating the DB on his a/c, he does it with his sysadmin a/c, of course, it works!, and then he just gives me his sysadmin username and password!! – gideon Jan 16 '11 at 9:22
  • Im not bad-mouthing sysadmins, just, these guys here, are just lost at everything! They don't seem to know what they're doing, and I have to resort to google for all the server/IIS config, and most of the time it has to do with something they didn't configure. – gideon Jan 16 '11 at 9:27

SQL Server Instance Name :

In SQL Server Management Studio > RegisterServers > double click your server to open the Object Explorer > right click to select the properties window > General Tab: to see the ServerName (instance name)

or Open a new query in SQL Server Management window and execute the following

-- to get the sql server instance name

select @@ServerName

Default instance datasource:

Data Source=.;Initial Catalog=myDataStore;...


Data Source=localhost;Initial Catalog=myDataStore;...


Data Source=machinename;Initial Catalog=myDataStore;...

  • +1 thanks so much. I'm not seeing the Register Servers menu/option anywhere, is it because I'm on express? – gideon Jan 16 '11 at 14:09
  • in Management Studio click on Database Engine, the Connect to Server dialog box opens > Options > Registered Servers tab. – Luke99 Jan 16 '11 at 14:38

you are using integrated authentication, so you don't have to provide even the username. it's machinname\sqlinstancename not the username

  • ah, excuse my ignorance, so how do I check for the sqlinstancename, assuming its not sqlexress – gideon Jan 16 '11 at 9:24
  • you can use osql -L. If it's the default instance name, just set the computername without any \name. – Mathieu Chateau Jan 16 '11 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.