Cannot connect to database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
warriorforgod
Forum Newbie
Posts: 15
Joined: Tue Jun 02, 2009 11:16 am

Cannot connect to database

Post by warriorforgod »

I am trying to connect to an mssql database and am getting the following error.

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: nagual.homelinux.net in /var/www/test.php on line 73

I have been give the following connection string to use, but I may not be using it correctly.

nagual.homelinux.net\jv_dwm,400010

Here is my code.

Code: Select all

 
<?php
 
error_reporting(E_ALL);
 
$dbuser='username';
$dbname='database name';
$dbpass='password';
$server='nagual.homelinux.net\jv_dwm:400010';
 
$connect = mssql_connect($server, $dbuser, $dbpass);
 
mssql_min_message_severity(10);
 
?>
 
 
Thanks in advance for any help.
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: Cannot connect to database

Post by mikemike »

According to the documentation the port number is specified using the syntax <server>,<port> - you're using <server>:<port>.

Try the following code:

Code: Select all

<?php
 
error_reporting(E_ALL);
 
$dbuser='username';
$dbname='database name';
$dbpass='password';
$server='nagual.homelinux.net\jv_dwm,400010';
 
$connect = mssql_connect($server, $dbuser, $dbpass);
 
mssql_min_message_severity(10);
 
?>
 
warriorforgod
Forum Newbie
Posts: 15
Joined: Tue Jun 02, 2009 11:16 am

Re: Cannot connect to database

Post by warriorforgod »

Hmm. Changed and still getting cannot connect.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Cannot connect to database

Post by califdon »

Include the "http://" at the beginning of your URL.
Post Reply