Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8436135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:06:18+00:00 2026-06-10T07:06:18+00:00

I have one service in C# which fetch records from oracle DB and insert

  • 0

I have one service in C# which fetch records from oracle DB and insert into MySql DB, after a successful insert of all records in MySql DB one of the column of my Oracle DB gets an updated i.e these many records has got inserted.

Since being a service it’s getting called after every 5 sec.

My problem is that how should i handle the deadlock situation in this case. Like my service fetches around 20,000 records from oracle DB and trying to insert in to MySql DB that takes around 7-8 seconds, mean while my service will get called, and since all records of previous session are not getting inserted there won’t be update in Oracle DB and next time it will again fetch the whole records, that i don’t want.

If possible provide some same code as well. This is pure Window base service not WCF.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:06:19+00:00Added an answer on June 10, 2026 at 7:06 am

    If you need “coordination” only in this service then use AutoResetEvent class.

    1. Create static field with AutoResetEvent instance.
    2. Your method called by timer should check this instance via AutoResetEvent.WaitOne(TimeSpan timeout) call on start.
    3. At the end of your method (called by timer) always call AutoResetEvent.Set(). try{} finally{} construction usually is ok for this call.
    4. During starting of your service call AutoResetEvent.Set() for created instance to allow the method (called by timer) start
      working.

    Using of WaitOne(TimeSpan timeout) with small timeout allow to finish timer “call” quickly if previous one is not finished yet.. So you still get ability to call you methods each 5 s.

    Sure checking about AutoResetEvent disposing will be needed before call its methods and maybe some additional checks…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my situation. I have written a WCF service which calls into one
I have a service which has one endpoint , I have defined this endpoint
I have a WCF service which accepts a string as a paramter for one
I have two windows application, one is a windows service which create EventWaitHandle and
I have a service class which has overloaded constructors. One constructor has 5 parameters
I have a service responsible for many tasks, one of which is to launch
I have one windows service which is running in every one min. But I
I have a web application which fetches information from a web service. It works
I have created one windows service which send an email notifications to users (list
Consider this problem: I have a program which should fetch (let's say) 100 records

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.