Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Posts: 12
Name: younes
Trades: 0
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!
 
 
Register now for full access!
Old 11-12-2007, 10:03 PM Re: How to connect to a database on another server?
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
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, 12:18 PM Re: How to connect to a database on another server?
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 933
Trades: 7
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,
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Reply     « Reply to How to connect to a database on another server?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.25815 seconds with 12 queries