Last week, I posted a question here looking for ways to figure out what was causing my client's server to make a huge number (as in 8500+) concurrent connections to the database. I received a number of very helpful responses, thanks everyone, and I thought I'd post the outcome so you all knew what happened.
My client has a staff programmer whose background is .asp rather than coldfusion and he's picked up coldfusion along the way piece by piece. He has a really strong grasp of some of it, yet is appallingly ignorant of some other aspects. For example he was astonished when I told him there was a thing called Application.cfm. And when I told him that you didnt have to open and close every datasource access his jaw dropped. He had been puzzling about how to make a connection to the datasource, and had found a blog post by Ben Nadel on how to do a query in CFScript (http://www.bennadel.com/index.cfm?dax=blog:186.view) . That looked much like his code in .asp so he figured that's how you do queries in ColdFusion. He followed Ben's blog to the letter - almost. He misseed the part in Ben's blog about where he says you have to close the connection again with # // Close the connection. # objConnection.Close();. The staff programmer had implemented the Paypal Express Checkout API, and modifited it a bit, and this is a high-traffic part of this site. Nearly every one of the users visiting the site would touch one or more of the pages, and would open multiple connections to the database, but there would be no close. So of course as users moved around the site the number of database connections would increase and increase until finally the whole site would crash, they'd reboot one of the servers and it would start all over again. Then I showed this staff programmer how he could do a query outside of CFSCRIPT using the CFQUERY tag - the more usual way to do it - and he nearly fell off his chair. He couldn't believe it was so simple. I explained Ben's post was about how to do it in CFSCRIPT but very few people ever do database access that way. So that's the issue - if you're going to do database accesses in CFSCRIPT, then: [A] think again and do them in tags like everyone else, there's nothing wrong with that, and [B] if you really insist on doing them in CFSCRIPT, then make sure you close the connection. [C] if ever you are tempted to follow option B, do A instead. Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274279 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4