EasyCFM.COM ColdFusion Forums / Coding Help! / 6 Sites, 1 Database

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: 6 Sites, 1 Database

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

Mr_Sausage
06-11-2007 @ 9:57 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 2
Joined: Jun 2007

Hi,

This is one of those really simple questions that I don't have the answer to, hence... can't progress further.

I have 6 sites all doing the same thing(ish) but I would like to bring them all together under 1 database, however the fundamental question is..

How can I query a database on another server as the datasources, etc have all been set up by the hosting comapanies and all the hosting companies are different?

I have tried:

<cfquery dbserver="IP ADDRESS HERE" datasource="request.datasource" username="#request.user#" password="#request.pass#"></cfquery>

but it won't seem to work.

Any help would be appreciated.

aadams
06-11-2007 @ 12:13 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 280
Joined: Nov 2005

DSN-Less connections came and went in CF5.  To date there is no stable substitute though there are some work-arounds for MS Access and MS Excel.  There have also been several attempts using the java.sql class, but I haven't seen it work.

Stepping back a pace:

Connecting to external datasources may sound like a great idea - and if done right it is - but you should consider performance when designing such an architecture.  

If you have 6 different hosts then they are all on different networks, therefore your connection between the hosts will be rather slow (compared to the typical 10mb or 100mb connection you'll have within a single hosts private network).  With the kind of setup you are talking about your sites will have to make several hops over unstable networks to query the database for each query in a request.  This is not good, and you'll quickly see the performance drop and instability.

In my experience it is better to have the db on the same machine rather than on different networks.  If you want to do it right, get a couple of dedicated servers with the same host/data center and use one for DB and the other for web (making the DSN connect to the internal IP of the DB server).  Dedicated servers are almost given away nowadays, in fact you can get a basic server running linux for just under $70 per month.  Of course you'll then either need to purchase CF server or use an alternative CF engine - but is well worth it in the end.

HTH

--Abram
CFXChange.com - ColdFusion Custom Tags and Components

Mr_Sausage
06-11-2007 @ 2:12 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 2
Joined: Jun 2007

Thanks for the advice, will have a rethink.

kevsarg18
06-12-2007 @ 11:34 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 428
Joined: Jun 2004

Also,

If the sites are similar enough to run the same DB (with site_id, or however you will) they are probably similar enough to run the same codebase to really cut down on maintenance. If you share the same CFC's & UDF's & custom tags you have much less work during updates. Go even further if it makes sense and build an application with multiple front end capabilities.



My CFML Scripts.

Sponsored By...
iOpenSoft, LLC is a Houston, Texas Advanced Technology Studio Specializing in Web Design, Web Development, iPhone App Development and Android App Development.