do anyone knows how to connect to a MS SQL server(database in internet,i have ip,db username and db password).i used mssql_connect from my PHP ,but how to activate it in windows or Ubutu.i download all dll files needed but i cant connect..pls help me....

Recommended Answers

All 2 Replies

How do you mean in Windows? It will be better understood if you will expantiaite on "activate it in windows or Ubutu". Do you want to connect to your database from your windows operating system such that you will be able to export/import data?
If yes, let the forum know.
Thank you.

Have you checked that you have the latest ntwdblib.dll( this has solved my connection problem)? You should paste this dll over your dll's from apache and php(I think it can be found in two places). Restart apache
then use mssql_connect like this:

$myServer = "xx.xx.xx.xx";
$myUser = "sa";
$myPass = "yyyyyyyyyyyyy";
$myDB = "zzzzzzzzzzz";

//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
  or die("Couldn't connect to SQL Server on $myServer");

//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
  or die("Couldn't open database $myDB");

If it still does not work you should try to connect to the database through MS SQL Management Studio.
If it does not connect talk to the owner of the database

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.