.Net ramblings
# Sunday, 10 October 2004
SQL Server - Access denied messages using Server=(local) with named instances

I'm developing a .net application that uses a sql server database.  i develop it on a desktop and a laptop, and i want to configure the app to use the local instance of sql server, rather than the named instances: LAPTOP\LAPTOP and DESKTOP\DESKTOP, because if the laptop is not on the network then it can't connect to any other db.  I tried connecting with the following connection string:

Server=(local); initial catalog=MyDB; UID=sa; PWD=whatever; 

but it didn't work,  "SQL Server does not exist or access denied".  I found out after a lot of searching that this is because i had installed a 'named instance' of sql server rather than the 'default instance'.  This is a tick box during the sql server install.  I also found out that its easy to change it back to a default instace.  all you do is run the sql server install again, and choose the default instance. you then have 2 sql server installations (they don't conflict).  if you look in the add/remove programs, there are 2 entries, one 'microsoft sql server' and another 'microsoft sql server (INSTANCE NAME)'.  if you need to copy the database from the instance to the default, do that via backup from the instance and restore to the default database. then just uninstall the instance sql server from control panel > add/remove programs. 

i also wasn't able to log in with "Server=localhost". i had to use "Server=(local)". 

 


Sunday, 10 October 2004 11:24:36 (GMT Daylight Time, UTC+01:00)  #    Comments [0]  Database

OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview