问题
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:
Thank you for the help!
回答1:
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:
- Enter MS SQL Server Configuration Manager.
- Go to SQL Native Client XX Configuration and click in Aliases
- 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.
来源:https://stackoverflow.com/questions/54178823/sql-proxy-alias-for-sql-server-express