954,116 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to connect remote mssql

danni web has been a great help to me i want just one more help

i am able to connect to MSSQL present in my localhost using wamp

but i am unable to connect to my MSSQL running in a pc with ip 123.xxx.xxx.xxx

can u guide me on how to connect to it..!

thanx in advance

daneuchar
Light Poster
30 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

do your sql manager supports ssh

network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
 

How to check that sir ?

daneuchar
Light Poster
30 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

oops , you can simply connect it using the connect function like below -

$con = mssql_connect($server_name,$username,$password);
$db_select = mssql_select_db($database_name);

you must have understood that, in the mssql_connect function, you need to provide the server's name at first parameter and so on.
put that ip there and it should work.

network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
 

You may Use the Belwo Specified Code:

$hostname = "123.xxx.xxx.xxx"; // usually is localhost, but if not sure, check with your hosting company, if you are with webune leave as localhost 
$db_user = "username"; // change to your database password 
$db_password = "password"; // change to your database password 
$database = "database_name"; // provide your database name 

# STOP HERE 
#################################################################### 
# THIS CODE IS USED TO CONNECT TO THE MSSQL DATABASE 
$db = mssql_connect($hostname, $db_user, $db_password);
mssql_select_db($database,$db); //Database Connect


EDIT: Sorry Code Edited for Some Error.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

he wants to connect to the microsoft's SQL server and not MySQL

network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
 

Sorry Friend.

am Edit my Code.

Thanx for Your Suggestion.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

hey i hope you have got you answer. its so useful postings.

fanza
Newbie Poster
3 posts since Oct 2009
Reputation Points: 8
Solved Threads: 1
 

Thanx a Lot guys !! U all ROCK :*:)

daneuchar
Light Poster
30 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You