Skip to main content
Participant
March 27, 2009
Question

cftransaction vs SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

  • March 27, 2009
  • 1 reply
  • 1402 views
Hi,

Quick question folks, I'm using a <cftransaction> and in my sql statement I'm using "SET TRANSACTION ISOLATION LEVEL READ COMMITTED;".

does the <cftransaction> tag needed if I have "SET TRANSACTION ISOLATION LEVEL READ COMMITTED;" statement within my sql statement? I'm not sure if this is necessary. here's my sample code:

<cftry>

<cfset _tStart = Timeformat(Now(), 'hh:mm tt')>
<cftransaction>
<!--- this stored proc has SET TRANSACTION ISOLATION LEVEL READ COMMITTED --->
<cfstoredproc datasource="DSN_CMS" procedure="[dbo].[proc_insertevents_backup]">
<cfprocresult name="rs1" />
</cfstoredproc>

</cftransaction>

<!--- this is optional --->
<cftransaction action="commit" />
<cfset _tEnd = Timeformat(Now(), 'hh:mm tt')>
<cfset loopTime = "#TimeFormat(DateAdd('n', DateDiff('n', _tStart, _tEnd) ,'00:00'), 'HH:mm')#" />
<cfcatch>
<!--- something happened, roll it back --->
<cftransaction action="rollback" />
</cfcatch>
</cftry>



This topic has been closed for replies.

1 reply

Inspiring
March 28, 2009
> Quick question folks, I'm using a <cftransaction> and in my sql statement I'm
> using "SET TRANSACTION ISOLATION LEVEL READ COMMITTED;".

I'm pretty sure a JDBC call performs an implicit commit when it completes,
unless there is a <cftransaction> block in play.

> does the <cftransaction> tag needed if I have "SET TRANSACTION ISOLATION LEVEL
> READ COMMITTED;" statement within my sql statement?

If I'm reading things correctly, your proc is protecting itself from
*other* transactions being in play when it runs, and it's isolation level
really has little to do with the transactionality you're applying to its
calling code.


It's difficult to say conclusively without seeing the proc code.

--
Adam