Monthly Archives: October 2014

Hitting Host Machine’s SQL Server from within a VM

I had a situation at home where I was running some code in Visual Studio on a virtual machine. The virtual machine was running using VMWare Player on my desktop machine.

I needed to access the database which was running on my host machine (the desktop machine) from within the VM. So I had to come up with a Connection String which was able to target the host machine. The following Connection String achieves that:

<add name="DefaultConnection" connectionString="Data Source=192.168.25.1,2310;Network Library=DBMSSOCN;Initial Catalog=AdventureWorld;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />

Note, I had to open port 2310 on the host machine’s firewall.

Now, I don’t need to install Sql Server on my virtual machines (which always seems to be a pain in the proverbial).