Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Point to localhost\sqlexpress using only localhost

Working on a common codebase, one developer is running SQL Server Express 2005 and the other 2 are running SQL Server 2005. Everything is working fine, but the connection strings differ. To maintain common configuration and build scripts we're looking to mask "localhost\sqlexpress" to just "localhost" like the other 2 developers.

Can this be done? Or, maybe there's a better way for all 3 to run on the same connection string... The solution sought is for all 3 to be able to run on the same file versions in the code repository.

I might not be 100% clear: basically I want this:

Data Source=localhost;Initial Catalog=Sample;Integrated Security=True 

to connect the exact same as this:

Data Source=localhost\sqlexpress;Initial Catalog=Sample;Integrated Security=True 

If at all possible.

like image 627
Chris Missal Avatar asked Jan 16 '09 05:01

Chris Missal


People also ask

What is localhost SQL Server?

SQL Location: Server Name or IP - If it is a local machine the server name will be (local) or localhost for the default instance, or if a named instance such as SQL Express it would be localhost\SQLExpress. If you are unsure, copy the value from the "Server name:" TextBox when connecting through SQL Management Studio.


1 Answers

Just tested things out and got it working.

sql express doesnt enable tcp/ip by default and when enabled doesnt use the default port 1433.

to make this happen you need to open up "Sql server configuration manager" then under protocols enable tcp/ip. after that double click "tcp/ip", select the "IP Addresses" tab and scroll to the bottom then blank the "TCP Dynamic Ports" and enter 1433 under TCP Port.

after all that restart the sql server service and it should work with the normal connection string.

like image 182
John Boker Avatar answered Sep 28 '22 11:09

John Boker