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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection failure to MSSQL on remote machine, using mssql_connect() 2

Status
Not open for further replies.

DanLW

Programmer
Dec 9, 2004
7
0
0
AU
I am failing to connect to a MSSQL database on a remote machine using mssql_connect().
Code:
$db = mssql_connect (‘<remote db server name>’, ‘<username>’, ‘<password>’);
if (!$db)
{
  echo “connection failure”;
}
else
{
  echo “connection successful”;
  mssql_close();
}

// returns “connection failure”

I can connect successfully when the application sits on the same box as the MSSQL database.
Code:
$db = mssql_connect (‘<local server name>’, ‘<username>’, ‘<password>’);
if (!$db)
{
  echo “connection failure”;
}
else
{
  echo “connection successful”;
  mssql_close();
}

// returns “connection successful”
I can connect successfully to the database on the remote machine using odbc_connect() WITH A DSN.
Code:
$db odbc_connect (‘<dsn to remote db server>’, ‘<username>’, ‘<password>’);
if (!$db)
{
  echo “connection failure”;
}
else
{
  echo “connection successful”;
  odbc_close();
}

// returns “connection successful”
Fails when connecting to the database on the remote machine using odbc_connect(), WITHOUT A DSN
Code:
$db odbc_connect (‘<remote db server name >’, ‘<username>’, ‘<password>’);
if (!$db)
{
  echo “connection failure”;
}
else
{
  echo “connection successful”;
  odbc_close();
}

// returns “connection failure”


APPLICATION SERVER
Microsoft Windows Server 2003
Standard Edition
Service Pack 1

IIS 6.0

PHP 5.0.4

REMOTE DATABASE SERVER
Microsoft Windows Server 2003
Standard Edition
Service Pack 1

Microsoft SQL Server 2005
Microsoft SQL Server Management Studio 9.00.3042.00

Any assistance greatly appreciated.

Dan
 
there are good user comments in the php manual for mssql_connect() that will probably help you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top