1

I installed Windows server 2008 and SQL Server 2008 on VirtualBox, now I want to remotely connect to it via php.
I don't know what kind of network connection is needed, how to set it and...

3 Answers 3

2

First you need to set your guest OS networking as Bridge. In my case I use eth1, but proably your is eth0.

alt text

Now when you start windows, check that the ip is of the same local network of your host machine (launch cmd and next digit ipconfig). If the ip is right, try to ping your guest machine from Ubuntu host machine:

ping ip_guest

If all is ok, now you can access your guest machine (windows) from your host machine (Ubuntu).

I've recently migrated an application from mssql 2005 to MySql (precisely MariaDB) and I have developed a set of scripts in php to do this task.

For remotly connect to a sql server I'have installed through Synaptic the php5-sybase extension.

Next from my php scripts I have opened two connection, one with sql server and one with MySql and migrated the desired data.

/*mssql*/
$server_from="ip_guest\SQLEXPRESS";
$username_from="mssql_user"; //mine is sa
$password_from="mssql_password";

/*MySql*/
$server_to   = "127.0.0.1";
$username_to = "mysql_user";
$password_to = "mysql_password";

//FROM Connect to MSSQL
$link_from = mssql_connect($server_from, $username_from, $password_from);
//TO Connect to MySQL
$link_to = mysql_connect($server_to, $username_to, $password_to);

Mssql function are analogue to the Mysql one: http://it.php.net/manual/en/book.mssql.php It change only the prefix...

1
  • By the way, you also have to enable the TCP listener service on port 1433 on the windows vm because its not enabled by default. also, you might want to enable the default "sa" account to use for development authentication. also, make sure windows firewall allows incoming 1433.
    – djangofan
    Nov 22, 2010 at 21:12
1

You can use a bridget Network Interface from the Virtual Machine, so you can use this one like a real Server...

1

Bridged networking

This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system's network stack.

Read the complete article here:

http://www.virtualbox.org/manual/ch06.html

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .