index > .NET Framework Data Access and Storage > Use of Transactions for long slow process and blocking

Use of Transactions for long slow process and blocking

Hello,

I have a question about the appropriate use of transactions when performing a long task.

I have a C# application which runs on a semi-frequent basis. The application downloads data from a number of different data sources, post-processes the data on the fly, then progressively writes the post-processed data out to a local SQL Server (2000) database. The download of data takes about 3 hours, and quite commonly dies part way through (due to unreliable data sources).

It seems like a good idea that I wrap the whole download process in a single transaction (using the SqlTransaction object), so that I can roll back if something goes wrong part way through.

What I hadn't anticipated, however, is that by wrapping the process in a transaction, as soon as a table has an INSERT command issued to it, subsequent attempts by other users to issue a SELECT command to that table are blocked, until the transaction is either committed or rolled back.

Is this the expected behaviour? I tried playing around with different IsolationLevels, but none of these seemed to make any difference.

I had hoped that wrapping the process in a transaction would isolate the affected tables while the download was under way, but permit other users read-only access to these tables such that they would see the data that was present before the transaction was initiated.

Any help would be greatly appreciated!

Thanks,

Nick.

Ntompson

Hi,

Yes, this is an expected behaviour. This dis-advantage has been overcome in SQL-Server 2005 by using a database level isolation setting called SNAPSHOT READ COMMITTED

Regards

Arvind T N

T.N. Arvind

Great - thanks for that. I noticed that this isolation level wasn't supported for SQL Server 2000. Gives me a good excuse to go to 2005...

Cheers,

Nick

Ntompson
reply 3

You can use google to search for other answers

 

More Articles

• Problem with calculated columns - no automatic refresh
• Problem getting schema information: AllowDBNull vs. IsNullable
• Connection problem to an Excel File with ado.net (OleDb.OleDbConn...
• EXE (client PC) donĀ“t show null values
• Updating SQL Server using DataSet
• How to test for Null values in ADODB recordset in VB.Net
• Parameters.Add - @MyParam doesn't get resolved with Advantage DB ...
• Data type mismatch in criteria expression
• GridView in Web Application Not Deleting Rows
• FAQ
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• FAQ
• Optimizing data transfer and storage whe
• HELP!! writing sql in vb.net (ado.net)
• Connection String
• Time Zone Problem in Web Service
• is it possible to interrupt fill method
• informix: exist a wizard to create datas
• Framework Versions
• A problem when trying to create a SQL da
• DataSet Vs DataReader????
• Execute a sql script using vb.net
• questions about Automatically Generating
• SQL Table Lookup Methods
• request help with DLL on database machin
• SQLServer Backup

Hot Articles

• Performance question with DataReader
• Best Practices question.
• Getting deleted child rows for a "S
• SQL server 2005 data base with visual st
• Master Detail Records
• Exception: DataTable internal index is c
• DataAdapter inserting values into the da
• How to avoid re-occurring Err "ORA-
• Too many connections to database
• how to retrieve image from database?
• Calculated Column --> Using Custom Ag
• Internal .Net Framework Data Provider er
• ASP 2.0 NET SQL Provider Membership Mana
• Display autonumber
• access sql server database with vb

Recommend Articles

• DataGridViewCellStyle Editor
• problem copying table from one database
• About Connection and Disconnected Archit
• Oracle not listed as a data source
• Informix Problem
• Connecting SqlExpress from .net 1.1
• oracleCommand error
• request help with DLL on database machin
• System.NullReferenceException: Using Dat
• Same Problems
• suggestion on DB design
• Enterprise Library problem with oracle 1
• DataSet thread safety
• How to Connect Microsoft Access database
• OleDbCommandBuilder doesn't generate any