2

I can't find what I need or I don't know what to search.Because we are a large team with different setup in our locals, if is possible somehow to enforce connection strings to be persistent across our locals.

Example: In config files

<connectionStrings>
    <add name="SomeEntities" 
         connectionString="data source=.\SQLEXPRESS;initial catalog=tests;...rest of it..."/>
</connectionStrings>

As in my case, because I installed SQL DEVELOPER (version is irrelevant) my local connection will be "data source=.\;initial catalog=tests;...rest of it..."

Is it possible to set a proxy in SQL Server Configuration Manager for <SQLSERVERNAME>\SQLEXPRESS to point on my local <SQLSERVERNAME>\

I'm not looking to install SQL Server Express, I want to setup a PROXY that will help the team to use SQLEXPRESS connection string to work on any installed SQL Server versions.

UPDATE:

Based on comments and responses, it's possible.

Prerequisites:

  • TCP/IP protocol must be enable for the instance (in my case port 1433)
  • To check go in CMD => netstat -an |find "1433"

Setup in SQL SERVER Configuration Manger: enter image description here

Thank you for the help!

SilentTremor
  • 4,747
  • 2
  • 21
  • 34
  • 2
    The question isn't very clear. `.\SQLExpress` is a *named instance* not a machine or server. A single machine can have *multiple* instances. SQL Server aliasing is available through the SQL Server Browser service **but** it sounds like the real issue is connection string management. – Panagiotis Kanavos Jan 14 '19 at 09:50
  • If I understand you correctly, you are in need of pointing to the correct SQL Instance every time. If that's the case, you need to configure each instance of SQL to use a different port number, i.e. default MS SQL Server port is 1433, etc. – Attie Wagner Jan 14 '19 at 09:53
  • 3
    You can have different app.config or web.config files per release and publishing profile. You can use different settings per environment using Web Config transforms [as shown in this SO question](https://stackoverflow.com/questions/3065492/different-connection-string-for-each-publish-profile-in-vs2010). Also check [Scott Hanselman's article on the subject](https://www.hanselman.com/blog/TinyHappyFeatures3PublishingImprovementsChainedConfigTransformsAndDeployingASPNETAppsFromTheCommandLine.aspx) – Panagiotis Kanavos Jan 14 '19 at 09:54
  • 1
    If you target .NET Core things are a lot easier as you no longer need config transforms to override settings. If you really need aliasing, you can specify an alias [through each computer's client configuration](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/create-or-delete-a-server-alias-for-use-by-a-client?view=sql-server-2017) – Panagiotis Kanavos Jan 14 '19 at 09:56
  • @PanagiotisKanavos thank you, dumb me, is called alias, yes .net core transform for user is straight forward – SilentTremor Jan 14 '19 at 10:34
  • 1
    Do not cross post questions across the network https://dba.stackexchange.com/questions/227071/sql-proxy-alias-for-sqlexpress –  Jan 14 '19 at 11:53

2 Answers2

3

I am not sure if it is the same case that experimented, but in the past, we had a scenario where every developer was using their own name of MS SQL Server instance, we decided to set a standard name in the connectionstring and everyone has configured an alias inside SQL Server Configuration Manager, the steps are:

  1. Enter MS SQL Server Configuration Manager.
  2. Go to SQL Native Client XX Configuration and click in Aliases
  3. Create a new Alias, here you should name it with the standard name that you have registered inside your connection string, inside the Protocol set TCP/IP and later in Server section, you should set up the current name of your local instance.

After that, you have completed the previous step you should be able to connect your local instance through the name that you have defined in the alias.

2

What are you talking about is called alias:

Create or Delete a Server Alias for Use by a Client

You can create an alias with name SQLSERVERNAME\SQLEXPRESS which will point to localhost and vice versa. Alias should be created on client machine.

sepupic
  • 8,409
  • 1
  • 9
  • 20