Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Simultaneous database query causing database error max_user_connections

I’m trying to import the excel data to mysql database by PHP Ajax method. When the user upload an excel, the jQuery will fetch each row by loop and send it to PHP via ajax but there are about 500++ rows. Due to that, the PHP is running the query simultaneously and causing the database error already has more than 'max_user_connections' active connections. Some of the query are working but some not.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

the jQuery will fetch each row by loop and send it to PHP via ajax

…this is a design flaw. If you try to generate 500 AJAX requests in a short space of time it’s inevitable, due to its asynchronous nature, that a lot of them will overlap and overload the server and database…but I think you’ve realised that already, from your description.

So you didn’t really ask a question, but are you just looking for alternative implementation options?

It would make more sense to either

  1. just upload the whole file as-is and let the server-side code process it.

Or

  1. If you must read it on the client-side, you should at least send all the rows in one AJAX request (e.g. as a JSON array or something).
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading