views:

131

answers:

2

I am moving data from a MSSQL database to a MySQL database. I need to connect with PHP to MSSQL and then insert into MySQL. Could someone tell me how to:

  • See if the mssql server is running remotely,
  • How to connect to it?

Code:

mssql_connect($host,$user,$pass) or die('Failed Server Connect! ' . mssql_get_last_message());
mssql_select_db($dbnm) or die('Failed DB Select!');

Note: The webserver and db are on separate machines but mysql and mssql are are the same db machine.

I change to: $dsnn = "Driver={SQL Server};Server={$host};Database={$dbnm}";

// Connect to the data source and get a handle for that connection.
$conn=odbc_connect($dsnn,$user,$pass);

I successfully figured out the Source issue and could not find db issue but now getting: I now have a message saying: Login failed for user "xxx".

Figured it out. Was told the wrong password. Reset and now works.

A: 

try **Telnet <IP Address> <Port Number>** ? Is any error shown?

noonex
What port does MSSQL run on? I know I can access the server because I have MySQL on it running just find cross server.
David
MSSQL runs on tcp port 1433
Jordan S. Jones
It sat there and did nothing on a blank cmd screen
David
A: 

Since you are running PHP on Windows, have you considered trying out the SqlServer driver for PHP? Where I work, we are using it on one of our projects, and have had wonderful results with it.

Jordan S. Jones