Jump to content

Recommended Posts

 

 

Hi guys,

 

I have a php program running on a server connecting to a MSSQL server on a different server and the connection works well.

I moved the program to a virtual machine but for some reason there is no database connection any more.

 

Is there a special way to connect to the database from a virtual machine ?

 

Here is the working connection :

 

class mssql

{

var $dbname;

var $server;

var $user;

var $password;

var $connection;

 

/**Constructor**/

function mssql ()

{

$this->dbname='[dbname]';

$this->server='192.168.0.5';

        $this->user='sa';

        $this->password='pass';

 

$this->connection = mssql_connect ($this->server,$this->user,$this->password);

 

if ($this->connection)

{

mssql_select_db ( $this->dbname, $this->connection) or die ( 'Can not select database' );

return $this;

}

return false;

}

 

/**closes the mssql connection**/

function close ()

{

return mssql_close ($this->connection);

}

/**shows the connection status.**/

function toString()

{

print "connected To: ".$this->connection;

}

 

/**performs a query **/

function query ($sql)

{

if ($sql)

{

$results= mssql_query ($sql, $this->connection);

return $results;

}

 

return false;

}

}

  • 3 months later...

Sorry to bump an old post:

 

Am getting the following error :

Fatal error: Call to undefined function: mssql_connect() in C:\apache2triad\htdocs\care2x\include\care_api_classes\class_mssql.php on line 36

 

and yes I can connect to the server from the VM both by remoting and accessing it via its IP.

 

 

Hi guys,

 

The problem was that I was using an old version of ntwdblib.dll.Which is  Version 2000.2.8.0. This doesn't work very well with MSSQL 2005 so I downloaded ntwdblib.dll 2000.80.194.0 which worked.

 

I've seen several unanswered posts and I think this could be the solution to them. So guys, I wouldn't want you wandering in the internet jungle like I did, give yourself some peace and download this.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.