Jump to content


Photo

How to connect to MSSQL database


  • Please log in to reply
3 replies to this topic

#1 tanveer

tanveer
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 08 March 2006 - 05:18 PM

Hello all,

I am new to this combination of php and MSSQL. I have to connect to MSSQL database and for that the web hosting company gave me userid,password and an ip. I can successfully connect to the MSSQL database and can create tables and all other things using the client-network utility and enterprise manager.

On testing purpose, I also connected to a local pc in intranet with MSSQL server running on that and tested my php pages.

Now, what I want to know is how to connect to that MSSQL server in the internet? Will it work just by changing the IP, username and passwd that web hosting company gave or do I have to do something more?

btw its a windows based hosting and as I know php well I was willing to use it as the scripting language instead of asp / asp.NET.

Hope I made myself clear.

Thanks in advance.

-tanveer

#2 elsint

elsint
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 March 2006 - 07:06 PM

Well, not an answer but another question :)

I am trying to connect a database that is on another server but I can't!
I'm trying the code below but can not get it worked.

$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("Remote Provider=bla.blablabla.edu; Data Source=name_of_the_database; User ID=blabla; Password=blabla");

I would appreciate if you tell me how you connect

Thanks!

#3 elsint

elsint
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 29 March 2006 - 12:56 AM

got it solved

$conn->Open("DRIVER=SQL Server;SERVER=server_ip;UID=username; PWD=password;APP=;DATABASE=database_name");

#4 VirM

VirM
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 10 April 2006 - 09:20 AM

[!--quoteo(post=359496:date=Mar 29 2006, 02:56 AM:name=elsint)--][div class=\'quotetop\']QUOTE(elsint @ Mar 29 2006, 02:56 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
got it solved

$conn->Open("DRIVER=SQL Server;SERVER=server_ip;UID=username; PWD=password;APP=;DATABASE=database_name");
[/quote]

Thank you, it works for me too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users