Reply
How to connect to a database on another server?
Old 11-12-2007, 08:02 PM How to connect to a database on another server?
Novice Talker

Posts: 12
Name: younes
Though I can setup an almost same database as another server, I'd like to directly connect to the other server. To do like this, one edit will affect 2 sites.

Can we use like this:

Quote:
$db_host = "202.101.93.94"; or like: $db_host = "http://anotherdomain.com";
$db_user = "dbuser";
$db_pwd = "dbpwd";

$qry = mysql_connect ($db_host, $db_user, $db_pwd);

__________________
tiamaz is offline
Reply With Quote
View Public Profile Visit tiamaz's homepage!
 
When You Register, These Ads Go Away!
Old 11-12-2007, 09:03 PM Re: How to connect to a database on another server?
joder's Avatar
Flipotron

Posts: 6,443
Name: James
Location: In the ocean.
Is your web server on the same network as the DB server? Do you have a web hosting plan with one company and a DB plan with another? What type of plan? There are several variables that would determine an answer.
joder is offline
Reply With Quote
View Public Profile
 
Old 11-13-2007, 11:18 AM Re: How to connect to a database on another server?
Super Spam Talker

Posts: 882
Hi tiamaz,

your code...
Quote:
$db_host = "202.101.93.94"; or like: $db_host = "http://anotherdomain.com";
$db_user = "dbuser";
$db_pwd = "dbpwd";

$qry = mysql_connect ($db_host, $db_user, $db_pwd);
Should work fine depending on how your database server is setup. You need to make sure the server your connect from has access to the remote database server - by default the remote database server probably restricts access from IP's off their range....

What database is it? Maybe we can help more. also, if there actually a problem or have you not tried your code? If there is please post the errror.

Warm regards,
Sir P is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to connect to a database on another server?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12876 seconds with 12 queries