Click here to Skip to main content
11,490,543 members (33,031 online)
Click here to Skip to main content

Tagged as

How to fix Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

, 2 Aug 2013 CPOL 31.6K 4
Rate this:
Please Sign up or sign in to vote.
Insert Ignore with select thousands of rows threw timeout expired exception

Using MySQL .NET /Connector with a thousands of rows to do an INSERT IGNORE command results in timeout expired exception. Normally we focus in connection time out or command timeout etc.

But in this case, the problem is with  net_read_timeout, because the command needs to read thousands of rows before to do the task.

The best way to fix it, is to increase the net_read_timeout (by default is only 30 seconds see mysql website) so, you allow the command sufficient seconds to read. If not, the connection will close, because net_read taked more time than the timeout setted.

So you need to type this in any MySQL Console or any User Interface like MySQL Workbench, you need to have administration permissions to change global variables: 

SET GLOBAL   net_read_timeout = 100; 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

AlbertoLeon CSharpMan
Technical Lead Get Me An Apartment
Spain Spain
I'm developer fall in love with C#, .NET and Mono.
Designing and programming websites since 2001.
I like literature (to read and to write), playing football (soccer)... and of course I'm great fan of La Roja (Spain football team)

At now I work in GetMeAnApartment, I do Research and Development features to upgrade our website (asp.net, MVC, MySQL) and business model (rental short stay apartments)


My Knowledge:
LANGUAGES: C#, XML, HTML, JavaScript, ActionScript, php, VisualBasic Script

TECHNOLOGIES: asp.net, asp.net mvc, php, flash, GTK#

APPLICATIONS: wordpress, wikimedia, I programmed modules for Macromedia Flash MX for myself

FRAMEWORKS: .Net Framework, Mono

SERVERS: IIS, apache2

SO: Windows, Debian

SOFTWARE: Visual Studio 2010, 2008. Monodevelop. Glade. Illustrator. Indesign. Photoshop. Dreamweaver.


Employment:

GetMeAnApartment
IT Director and website developer, 2010 - present

Círculo Rojo Publicidad y Comunicación
IT Director and websites developer, 2007 - 2010

Dédalo Creative
Co-founder,Programmer and Developer, Graphical designer 2006 - 2007

Costa Mediterránea Comunicación
Chief writer, 2004 - 2006

Stalker Creacion
Web designer and developer, 2001 - 2003

Education
Myself
Designer and Programmer, 2001 - present

Jaime I, University
Advertising, 2000 - 2005
Follow on   Twitter

Comments and Discussions

 
GeneralMy vote of 3 Pin
satish koladiya27-Aug-13 0:41
professionalsatish koladiya27-Aug-13 0:41 
GeneralMy vote of 5 Pin
fredatcodeproject2-Aug-13 7:02
memberfredatcodeproject2-Aug-13 7:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 2 Aug 2013
Article Copyright 2013 by AlbertoLeon CSharpMan
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid