Jump to content

How to connect to MSSQL database


tanveer

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

  • 3 weeks later...
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!
Link to comment
Share on other sites

  • 2 weeks later...
[!--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.
Link to comment
Share on other sites

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.