Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP to MSSQL

Status
Not open for further replies.

likelylad

IS-IT--Management
Jul 4, 2002
388
GB
I use the following code to connect to a MSSQL server and it works successfully
Code:
$myServer = "myserver";
$myUser = "user";
$myPass = "pass";
$myDB = "thedb"; 

//create an instance of the  ADO connection object
$conn = new COM ("ADODB.Connection")
  or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB; 
  $conn->open($connStr); //Open the connection to the database

However this SQL server is now being decommissioned and I have to connect to a different MSSQL server.

The developers have given me a server name of "myserver1\instance1" but I am unable to connect via PHP.

When I put the new server name in Management Studio, I have no issue connecting.

Thanking in advance for any help received.
 
can your server get an connection to the new db server at all (try a ping)?

this may be a data network issue rather than a problem with your code.




A Maintenance contract is essential, not a Luxury.
Do things on the cheap & it will cost you dear
 
The physical server on the network is myserver1 and there are no issues pinging this but the database is referenced as myserver1\instance1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top