Jump to content

Archived

This topic is now archived and is closed to further replies.

tanveer

How to connect to MSSQL database

Recommended Posts

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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
got it solved

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

Share this post


Link to post
Share on other sites
[!--quoteo(post=359496:date=Mar 29 2006, 02:56 AM:name=elsint)--][div class=\'quotetop\']QUOTE(elsint @ Mar 29 2006, 02:56 AM) [snapback]359496[/snapback][/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.

Share this post


Link to post
Share on other sites

×

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.