Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Error Connecting to Named Instance Expand / Collapse
Author
Message
Posted Friday, October 26, 2012 2:10 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 30, 2013 8:28 AM
Points: 3, Visits: 4

I had to install a new instance of SQL Server 2008 R2 Express on Windows 2007 because our SQL Server 2008 R2 Trial version ended (It's just a development machine). I was able to connect to the Express version using SSMS using the machine name\instance name but couldn't connect using the web config from our web service (error establishing connection to SQL Server - error 40). Everything is local. I did read that you if you have a named instance, it connects with dynamic ports but I wasn't sure if this was true when everything is local but I did try changing the port to a fixed one and opened the windows firewall but it still didn't work. So I then changed the port to the default port of 1433 and it did work. So three questions: 1) does that mean I didn't open the firewall correctly when I had another port (I used 1435, which didn't seem to be in use by other program)? 2) In using 1433, it complained that the database name was incorrect and it mentioned the old database name that we used to call that database. But I changed our current database name to that old name and all worked fine. Not sure why/how it found/used that old name? 3) Any issue leaving it as the default port at 1433 when it is a named instance? Does it matter? Thank you!

Post #1377840
Posted Saturday, October 27, 2012 8:10 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, July 28, 2014 10:40 AM
Points: 47, Visits: 813
Hi,

This could have more than few speculations, usually it is necessary to have sql browser service to be running if you're using named instance if you hadn't uninstalled previous default instance, and since you used custom port, did you happen to configure that port for the instance in the connection string?

Regards,
Post #1377952
Posted Saturday, October 27, 2012 1:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 30, 2013 8:28 AM
Points: 3, Visits: 4
Hi, yes, I did add the port number to the connection string in the web.config in the format of machine\instance,port (in the same format as I connected via SSMS) and I did update the configuration for the instance in the SQL Server Configuration Manager adding the port. But it didn't work. But once I added the default port (1433) to the instance in the SQL Server Configuration Manager it did work. I had tried the Browser Service as well but couldn't get that to work so that's when I tried just tried using the default port of 1433. I think some how even though I updated my firewall it just didn't work somehow. And everything is local so I wouldn't think that I would need to update the ports but I did. Also the weird thing is that when using the default port, it uses our old database name. Thank you.
Post #1377978
Posted Sunday, October 28, 2012 10:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 30, 2013 8:28 AM
Points: 3, Visits: 4
Fixed, I had a typo in the port assignment.
Post #1378034
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse