Reputation: 13226
I need to connect to a remote database server with PHP to query and return data.
So far, I have tried this:
$connection = mssql_connect('[redacted]:1433\SQLEXPRESS', '[redacted]', '[redacted]');
and
$connection = mssql_connect('[redacted]', '[redacted]', '[redacted]');
Both result in FALSE, but no error thrown. What am I missing? It doesn't even seem to attempt to connect (fails very quick).
Upvotes: 0
Views: 2035
Reputation: 13226
Good answer by AlexC, but what I wound up doing was converting the MSSQL database over to MySQL and performing the migration with the Migrate framework (Drupal).
Upvotes: 0
Reputation: 1141
Usually this isn't so much about the connection code as the setup of the external DB server. First try this:
$connection = mssql_connect('[redacted]\SQLEXPRESS', '[redacted]', '[redacted]');
But you are connecting to SQL Express which by default doensn't accept any incoming TCP/IP requests, so if that doesn't work out, you'll need to check the configuration (or if it's truly external, have the DBA check it) and make sure:
Upvotes: 1