简体   繁体   English

连接到并行VM中运行的SQLServer

[英]Connect to SQLServer running in a parallels VM

I'm running a Windows 7 VM via Parallels on OSX. 我在OSX上通过Parallels运行Windows 7 VM。 There's an instance of SQL Server running on that VM. 在该VM上运行了一个SQL Server实例。 I would very much like to be able to connect to that instance from my host (OSX). 我非常希望能够从我的主机(OSX)连接到该实例。 I want to be able to leverage my local RoR environment with SQLServer as a backend. 我希望能够利用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! TIA!

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连接到parallels vm上安装的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 - >配置工具 - > SQL Server配置管理器 - >启动SQL Server Browser服务

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) (当然主机是你的vm的ip当然)

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. 对我来说,除了Pavel和Ed的有用建议之外,我还需要在Windows VM上的Parallels中设置一个额外的适配器作为仅限主机的适配器。 Then, I assigned that adapter a static IP in the VM and used that IP in my connection string. 然后,我在VM中为该适配器分配了一个静态IP,并在我的连接字符串中使用了该IP。

More details are available here which helped me get my configuration working. 这里提供更多详细信息,帮助我完成配置工作。

This is the most relevant section: 这是最相关的部分:

First, define another network adapter in Parallels. 首先,在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. 此网络适配器将具有静态IP,并且仅允许来自主机(即OS X)的连接。此部分不能运行Parallels。

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 在Parallels的“虚拟机”菜单中选择“配置”选择“硬件”选项卡在左侧列表中添加新的网络适配器从“类型”下拉列表中选择“仅主机网络”并确保已选中“已连接”记下MAC地址按“确定”

Next, we need to set a static IP for the new network adapter. 接下来,我们需要为新网络适配器设置静态IP。

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. 启动Parallels,在我的例子中,Windows XP(其他版本的Windows应该类似)转到控制面板中的网络连接如果您不确定哪个是新的,则新的LAN连接将在列表中(它应具有最高编号)您可以通过检查状态来比较MAC地址启动属性面板以获得正确的LAN连接并转到Internet协议(TCP / IP)属性输入静态IP 10.37.129.10(这是在Parallels为Host-Only Networking保留的范围内,并将子网掩码设置为255.255.255.0。 Leave the gateway blank. 将网关留空。

Save the changes by pressing OK 按“确定”保存更改

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页面中 (“象限”的文档,但对任何安装都相关)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM