> -----Original Message-----
> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 11, 2003 5:38 PM
> To: CF-Talk
> Subject: datasource connections
> 
> Can anyone give me an official answer to this question (unspecified is a
> valid answer, of course):
> 
> Do all queries from a single request use the same database connection?

Yup.  At least by default.  You can set CF not to cache DB Connections...
I'm not honestly sure if that uses a new connection with each request or
each statement...

 
> Obviously that's assuming all queries are to the same datasource.  If the
> answer is yes, what about this question:
> 
> Can multiple requests pass queries over the same database connection in a
> mixed order (request1query1 the request2query1, request1query2)?

Yes, each CF thread will create its own connection to the DB.  To test this
just remember that CB connections are, by nature serial interfaces (commands
go in one at a time in order - a new command can't go in until the last one
is done).  Just set up two templates: in the first run a CFQUERY that takes
a long time to return (select lots of rows with many nested joins or
something - just so long as it takes a long time); in the second do a query
that returns instantly.

Run the fist and before it finishes, run the second - the second will return
while the first is still working showing that two connections are in use.

This is exactly the reason that DB Transactions (and by extension the
CFTRANSACTION tag) exist.

Most enterprise DB tools come with a client tool that let you trace all
activity (in SQL Server this is "Profiler") - the best thing to do is set up
the scenarios you're concerned with an trace the results: you'll see every
connection as it's opened and the statement(s) that use it.

It's actually a (REALLY geeky) thrill... kind of voyeuristic.  ;^)

Jim Davis

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to