Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy .net mysql read() method freeze

    Hello, I'm getting a rather bizarre problem.

    I am using mysql with c# and .net, visual studio 2005. I have a simple loop to read data based on a query until the results are exhausted:

    while(datarader.Read())
    {
    //do stuff
    }

    Now...I am trying to go through many thousands of records...and this loop is sort of required to run for more than an hour. It works fine for a while... but in the middle it freezes.

    In debug mode I found out that it freezes on the .Read() method, so the culprit is not my own code. if I try to step over Read() it simply stays there.

    If I try to make it "continue" it simply returns to the freeze state. It does not terminate the application or throw an exception however.

    What is going on and how can I fix it? Thank you for any help!!

  • #2
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,100
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Your server could be timing out on you.

    What kind of a query are you using? Can it be changed so that it's more efficient?
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #3
    New Coder
    Join Date
    Jan 2009
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Well..if it was timing out I would be gettting a fatal error exception.

    Though it could be some bizarre thing happening at low level where the connection is trying to close because of timeout and the read operation is trying to happen at the same time.

    One possible thing might be that ..since I have scores of thousands of records and the script takes hours, maybe the default way in which the read op is done is causing a problem and I need to set commandbehavior to single row.

    It's really weird...I will have to try it out on monday.

    The query is a basic select thing with a where clause.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •