View Full Version : connecting to external databases
PaulC2K
11-28-2006, 07:03 PM
I've had a search and havent found anything, so here we go...
Im trying to connect to the phpbb2 db on another domain (same hosting server though) and im wondering what i need to do to feed from that database?
I've tried using the simplified domain name ie domain.com, as well as including www. and the full http and i get the same message:
Error connecting to specified news source with username and password specified. Additionally, no recycled data was found that could be used. You must enable both Caching support and Failsafe Support in order to use cache on failure feature.
Now i know my settings are correct, the database im trying to connect to a duplicate of what i have via localhost, that works a treat, but while its fine for a local database, its not much use for external ones.
I've given the cPanel SQL Access Hosts the domain name im trying to connect from, as well as its IP address (the servers at least) with no success.
Anyone know what im supposed to be doing here? Never actually tried connecting to an external db before, so may come in handy for other stuff too one day :)
Great script too btw :)
Patrick
11-29-2006, 05:06 PM
I have connected to remote servers using the script (in fact, the script was designed with such implementation in mind).
As you stated, you had to add the IP, the domain, and the server domain (whatever it may be) to the list of access hosts. With cPanel you should not have to do more than this.
However, you should also make sure that you can connect on the port itself, 3306 by default, which may be getting blocked by a firewall.
The database server that you should set in the control panel can be the server domain , the ip address, or similar (srv01.somedomain.com or 123.123.123.123 for example). The server name string is being passed directly into mysql_connect ( refer to http://www.php.net/mysql_connect ) so there may be other things involved that you are not seeing... such as a non-standard port or SQL safe mode being involved (refer to link I just gave you).
PaulC2K
12-03-2006, 03:27 PM
Hi,
Thanks for the reply, i've only just had chance to look at this and theres still problems.
I've used the mysql_connect script to check and it only works when using localhost, even if the domain given is the one the file is hosted on.
When i specify :3306 (same as when i dont) i get:
Warning: mysql_connect(): Host '66.29.101.xxx' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home2/lfsh/public_html/dbtest.php on line 2
Could not connect: Host '66.29.101.24' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'
cPanel access hosts has the shared servers IP, its own domain, 'localhost' and the domain wanting access.
Does this error message mean anything to you, does it highlight what the issue is with? I was hoping that i could get this script to pull topics relevent to certain websites, but if i cant access the database in this manner then thats something i hadnt considered, if its purely an issue with the hosting company blocking this then thats not so much of an issue, im waiting till im done testing a few things then moving out because of similiar issues like this, so i can check with potential hosts if I know what my issues are, so i can live with it i guess, however not knowing whats causing the issue leaves me puzzled :(
Patrick
12-03-2006, 04:43 PM
It looks like it told you what the error was.
"Warning: mysql_connect(): Host '66.29.101.xxx' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home2/lfsh/public_html/dbtest.php on line 2"
Looks like your IP is being blocked by the DB server due to several connection errors... either invalid connection attempts (such as bad authentication) or connections that are getting interrupted.
In any case, the system admin of the db server is going to need to run "mysqladmin flush-hosts". Your IP WILL be blocked by the MySQL server until this command has been executed (it is a safe guard against attacks).
Additional information: http://dev.mysql.com/doc/refman/5.0/en/blocked-host.html
You need to get that problem fixed first before you can begin to troubleshoot. Once it is fixed, try using your own little test script again and see what it tells you.
PaulC2K
12-03-2006, 06:53 PM
Hi,
Thanks for pointing me in the right direction, contacted the hosts and asked them to clear the blacklist and its worked a treat :D
At least thats one thing less to worry about, and the whole thing has given me an idea for something slightly different too.
Thanks,
Paul
Powered by vBulletin™ Version 4.0.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.