仅使用localhost指向localhost\sqlexpress [英] Point to localhost\sqlexpress using only localhost

查看:306
本文介绍了仅使用localhost指向localhost\sqlexpress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用通用代码库,一个开发人员在运行SQL Server Express 2005,其他两个在运行SQL Server2005。一切工作正常,但是连接字符串不同。为了保持通用的配置和构建脚本,我们希望像其他2个开发人员一样将 localhost\sqlexpress 屏蔽为 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.

可以这样做吗?或者,也许有更好的方法让这3个文件都在相同的连接字符串上运行...寻求的解决方案是让这3个文件都可以在代码存储库中的相同文件版本上运行。

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.

我可能不是100%清楚:基本上我想要这样:

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

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

与此连接完全相同:

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

如果可能的话。

推荐答案

只需测试一下并

sql express默认情况下不启用tcp / ip,并且在启用时不使用默认端口1433。

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

要实现此目的,您需要打开 SQL服务器配置管理器,然后在协议下启用tcp / ip。双击 tcp / ip后,选择 IP地址选项卡并滚动到底部,然后空白 TCP动态端口并在TCP端口下输入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.

在重新启动sql server服务之后,它应该可以使用正常的连接字符串。

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

这篇关于仅使用localhost指向localhost\sqlexpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆