MX 6.1 environment. For some applications, I do some datasource setup
in the app.cfm to separate development and production environments,
amongst other things. So my app.cfm has some code like this
<cfswitch expression="#server_name#">
<cfcase value="server1">
<cfset REQUEST.thisDSN = "devDS">
</cfcase>
<cfcase value="server2">
<cfset REQUEST.thisDSN = "productionDS">
</cfcase>
</cfswitch>
then in a page in the application, i have some transaction processing
<cftransaction>
<cfquery name="1" datasource="#REQUEST.thisDSN#">
update foo set foo = bar where bar = foo
</cfquery>
<cfquery name="2" datasource="#REQUEST.thisDSN#">
update bar set bar = foo where foo = bar
</cfquery>
</cftransaction>
sometimes, but not always, i will get this error:
--
Data source devDS verification failed. The root cause was that:
java.sql.SQLException: Datasource names for all the database tags within
CFTRANSACTION must be the same.
The error occurred on line 232.
--
I was under the impression that REQUEST is a superset of the VARIABLES
scope, and will always be thread safe and limited to the CURRENT REQUEST
only. While the error would imply that I am getting
different results for the REQUEST variable within the transaction, I
have seen no evidence to back this up. Specifically, whenever it does
fail, it always gives the proper datasource in the error message, NEVER
giving the "other", "improper" datasource... in this case it would be
"productionDS".
I can work around this problem by setting variables.thisDSN =
REQUEST.thisDSN at the top of the transaction, then just calling
#thisDSN# in the datasource field...but what's the point? I thought
REQUEST was exactly the same as the VARIABLES scope, excpet REQUEST
could be read by all parts of the thread (including custom tags). Why
then would it not, within the request, always define request.thisDSN
exactly the same way?
Any ideas? & TIA,
-Jeff
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183438
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54