macos 连接到并行虚拟机中运行的 SQLServer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3240374/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Connect to SQLServer running in a parallels VM
提问by Bobby B
I'm running a Windows 7 VM via Parallels on OSX. There's an instance of SQL Server running on that VM. I would very much like to be able to connect to that instance from my host (OSX). I want to be able to leverage my local RoR environment with SQLServer as a backend.
我正在通过 OSX 上的 Parallels 运行 Windows 7 VM。该 VM 上运行着一个 SQL Server 实例。我非常希望能够从我的主机 (OSX) 连接到该实例。我希望能够以 SQLServer 作为后端来利用我的本地 RoR 环境。
I can't get the VM to respond to any requests from my Mac and I haven't a clue where to begin the troubleshooting process.
我无法让 VM 响应来自 Mac 的任何请求,而且我不知道从哪里开始故障排除过程。
Can anyone provide any insights or helpful resources?
任何人都可以提供任何见解或有用的资源吗?
TIA!
蒂亚!
采纳答案by Pawel Brzeminski
Bobby, if you want to connect from your mac osx to a sql server installed on a parallels vm you need to do 3 things:
Bobby,如果你想从你的 mac osx 连接到安装在并行虚拟机上的 sql server,你需要做 3 件事:
1) Enable remote connections on your sql server.
1) 在您的 sql 服务器上启用远程连接。
Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server Surface Area Configuration -> Surface Area Configuration for Services and Connections -> Database Engine -> Remote Connections -> Local and remote connections -> Enable TCP/IP -> Apply
Microsoft SQL Server 2005 -> 配置工具 -> SQL Server 表面区域配置 -> 服务和连接的表面区域配置 -> 数据库引擎 -> 远程连接 -> 本地和远程连接 -> 启用 TCP/IP -> 应用
2) Turn on the SQL Server Browser service (sql server express and dev edition turn this off by default) Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server Configuration Manager -> Start SQL Server Browser service
2)开启SQL Server Browser服务(sql server express和dev edition默认关闭) Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server Configuration Manager -> Start SQL Server Browser service
3) Configure the firewall to allow network traffic
3) 配置防火墙以允许网络流量
You can configure it per program or I just opened a port in firewall exceptions (1433 by default for SQL Server 2005)
您可以按程序配置它,或者我只是在防火墙例外中打开了一个端口(SQL Server 2005 默认为 1433)
For instance my jTDS connection string looks like that:
例如,我的 jTDS 连接字符串如下所示:
jdbc:jtds:sqlserver://10.211.55.7:1433;DatabaseName=master
(where the host is your vm's ip of course)
(当然,主机是您虚拟机的 ip)
回答by mdrewlo
Posting a new answer since I cannot comment, yet.
发布一个新答案,因为我还不能发表评论。
For me, in addition to the helpful advice from Pavel and Ed that is all required, I had to setup an additional adapter in Parallels on the Windows VM as a Host-only adapter. Then, I assigned that adapter a static IP in the VM and used that IP in my connection string.
对我来说,除了需要 Pavel 和 Ed 的有用建议之外,我还必须在 Windows VM 上的 Parallels 中设置一个额外的适配器作为仅主机适配器。然后,我在 VM 中为该适配器分配了一个静态 IP,并在我的连接字符串中使用了该 IP。
More details are available herewhich helped me get my configuration working.
This is the most relevant section:
这是最相关的部分:
First, define another network adapter in Parallels. This network adapter will have a static IP and will only allow connections from the host, that is OS X. Parallels cannot be running for this part.
Choose Configure… in the Virtual Machine menu of Parallels Choose the Hardware tab Add a new network adapter to the list on the left Choose Host-Only Networking from the Type dropdown and be sure Connected is checked Make a note of the MAC Address Press OK
Next, we need to set a static IP for the new network adapter.
Start Parallels and, in my case, Windows XP (other versions of Windows should be similar) Go to Network Connections in the Control Panel The new LAN connection will be in the list, if you are unsure as to which one is the new one (it should have the highest number) you can compare the MAC address by checking the status Bring up the properties panel for the correct LAN connection and go to the Internet Protocol (TCP/IP) properties Enter a static IP of 10.37.129.10 (which is in a range that Parallels reserves for Host-Only Networking) and set the subnet mask to 255.255.255.0. Leave the gateway blank.
Save the changes by pressing OK
首先,在 Parallels 中定义另一个网络适配器。此网络适配器将具有静态 IP,并且仅允许来自主机(即 OS X)的连接。Parallels 无法为此部分运行。
在 Parallels 的 Virtual Machine 菜单中选择 Configure... 选择 Hardware 选项卡 在左侧的列表中添加一个新的网络适配器 从 Type 下拉列表中选择 Host-Only Networking 并确保选中 Connected 记下 MAC 地址 按 OK
接下来,我们需要为新的网络适配器设置一个静态 IP。
启动 Parallels,在我的情况下,Windows XP(其他版本的 Windows 应该类似) 转到控制面板中的网络连接 如果您不确定哪个是新的,新的 LAN 连接将出现在列表中(它应该有最高的数字)您可以通过检查状态来比较 MAC 地址 调出正确的 LAN 连接的属性面板并转到 Internet 协议 (TCP/IP) 属性输入 10.37.129.10 的静态 IP(这是在 Parallels 为仅主机网络保留的范围内)并将子网掩码设置为 255.255.255.0。将网关留空。
按 OK 保存更改
回答by Ed Harper
You need to make sure remote connections are enabled in SQL server and open the relevant ports on the Windows firewall.
您需要确保在 SQL Server 中启用远程连接并在 Windows 防火墙上打开相关端口。
All the relevant steps are listed in this MSDN page(documentation for "Quadrant", but relvant to any installation).
此 MSDN 页面中列出了所有相关步骤(“象限”文档,但与任何安装相关)。