SQL queries from 2 concurrent app instances not allowed

Hi all,

I have a web app with MySql as back-end. In debug mode or just 1 single deployed instance, all SQL queries work fine. If I opened 1 instance in Chrome and another instance in IE, when both instances trying to issue the same SQL query (which takes around 3 or 4 seconds), error occurs: A query is already in progress.

Please advice!

Make sure your DB connection is either temporary or a property of Session. Don’t share DBConnections across the entire app.

Yes I did, database instance is a property of session and database.Connect is put in session.open

Another thread about this message.


I read that post, doesn’t seem to have a solid clue for solution?

What happens if you try the same query from two different apps? Do you get the same error?

I think I was using an old mind set from desktop programming to web programming (this is my first web app). I create a database instance and connect it during session.open, this connection remain alive during the whole session which may due to the error. I tried with a simple test that if I create a new database instance and connect to it every time before I issue the SQL statement, and close it after, it seems the problem has been solved (of coz still need deeper testing). But I think this should be the way how a web app to communicate with the database.