dhimok Posted August 24, 2007 Share Posted August 24, 2007 Hi everyone! Is it possible to connect to a database on an other server? if yes how thanks Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/ Share on other sites More sharing options...
Fadion Posted August 24, 2007 Share Posted August 24, 2007 Usually there is a web server and database server, so files and databases stand on different servers. Just use mysql_connect('other server host', 'user', 'pass'). Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332481 Share on other sites More sharing options...
dhimok Posted August 24, 2007 Author Share Posted August 24, 2007 should i use the ip address of the other server as host Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332482 Share on other sites More sharing options...
hitman6003 Posted August 24, 2007 Share Posted August 24, 2007 so long as the host name is in DNS correctly, it doesn't matter Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332483 Share on other sites More sharing options...
teng84 Posted August 24, 2007 Share Posted August 24, 2007 theres no diff when you connect your db in your local machine Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332486 Share on other sites More sharing options...
trq Posted August 24, 2007 Share Posted August 24, 2007 theres no diff when you connect your db in your local machine Sorry teng, did you even read the question? As for ip vs hostname, it is slightly quicker and recommended to use the ip address. Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332503 Share on other sites More sharing options...
MadTechie Posted August 24, 2007 Share Posted August 24, 2007 Very true thope but only if the IP is static, if its dynamic then use the hostname (so it can be resolved by the DNS, of course this is a little slower) Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332507 Share on other sites More sharing options...
teng84 Posted August 24, 2007 Share Posted August 24, 2007 i know that thorpe . look im sure that this guy know how to connect db in the local machine right?? now tell me is there diff when you connect to other server something like Usually there is a web server and database server, so files and databases stand on different servers. Just use mysql_connect('other server host', 'user', 'pass'). cheersss!!! Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332508 Share on other sites More sharing options...
teng84 Posted August 24, 2007 Share Posted August 24, 2007 guys slower??? can you even recognize the difference its almost the same its even faster than the light i guess so you wont recognize it Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332510 Share on other sites More sharing options...
trq Posted August 24, 2007 Share Posted August 24, 2007 Very true thope but only if the IP is static Seriously.. who runs a server using a dynamic ip? :-) I know I used to run dev servers from home using a dynamic ip, however, I would never run any production server without a static ip. i know that thorpe . look im sure that this guy know how to connect db in the local machine right?? now tell me is there diff when you connect to other server Sorry teng, your shorthand English made it hard to see the point to your post. guys slower??? can you even recognize the difference its almost the same its even faster than the light i guess so you wont recognize it Hostname vs IP adds another layer that simply does not need to be there. Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332513 Share on other sites More sharing options...
MadTechie Posted August 24, 2007 Share Posted August 24, 2007 1. its not the speed of light, that FDDI and even then the data needs to be translated and relayed.. 2. the IP doesn't need to be looked up in a DNS thus its faster. Very true thope but only if the IP is static Seriously.. who runs a server using a dynamic ip? :-) I know I used to run dev servers from home using a dynamic ip, however, I would never run any production server without a static ip. Erm.. my last company did before i join LMAO.. yeah i know but its worth saying, just incase someone is trying to cut costs Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332516 Share on other sites More sharing options...
teng84 Posted August 24, 2007 Share Posted August 24, 2007 i dont understand you thorpe your the only person that keeps on complaining my ENGLISH I hate ENGLISH but what can i do, its the universal @@@@ so I need to use it look i know four languages and 3 dialect so maybe thats why i cant be as good as Americans do Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332523 Share on other sites More sharing options...
trq Posted August 24, 2007 Share Posted August 24, 2007 I am not American. And I'm sorry, the fact that English is not your first language explains alot. I will be sure to keep that in mind in future when I'm reading your posts. Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332533 Share on other sites More sharing options...
Fadion Posted August 24, 2007 Share Posted August 24, 2007 we are discussing about a language, but its php and not english lol jk. About the ip vs hostname thing, using ip will be faster as it doesnt need resolving and using the application layer at all. But it is very general and would be taken in consideration when dealing with large systems. In this case, dhimok, use whatever u like Quote Link to comment https://forums.phpfreaks.com/topic/66424-database-connect/#findComment-332541 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.