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.
开发者_JAVA百科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.
try **Telnet <IP Address> <Port Number>**
? Is any error shown?
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.
精彩评论