Home > Software engineering >  Multiple threads access the same database, database error 2006 and 2013
Multiple threads access the same database, database error 2006 and 2013

Time:09-27

Database application needs to access frequently, single thread to run is that before, and in small amount of data of multithreading is also no problem, but in a multi-threaded data errors will be reported to the 2006 and 2013, by the way, I use all of the threads is a database connection, please friends help to analyze, thank you,

CodePudding user response:

It is how to calculate the points for the first time I post like a score is not enough,,,

CodePudding user response:

Can add interlock? Lock the database operation, after operation to unlock

CodePudding user response:

A thread is a connection, more convenient

CodePudding user response:

Had better use the database connection pool, so that we can better support multithreading

CodePudding user response:

reference woshi_hujunjun reply: 3/f
a thread connection, more convenient

Serious agree!
  • Related