Connect to SQLServer running in a parallels VM

别说谁变了你拦得住时间么 提交于 2019-11-30 02:12:53

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:

1) Enable remote connections on your sql server.

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

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

3) Configure the firewall to allow network traffic

You can configure it per program or I just opened a port in firewall exceptions (1433 by default for SQL Server 2005)

For instance my jTDS connection string looks like that:

jdbc:jtds:sqlserver://10.211.55.7:1433;DatabaseName=master

(where the host is your vm's ip of course)

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.

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. 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

You need to make sure remote connections are enabled in SQL server and open the relevant ports on the Windows firewall.

All the relevant steps are listed in this MSDN page (documentation for "Quadrant", but relvant to any installation).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!