I have an application which runs some multi-threading process.
In each thread I’m sharing the same connection to my mysql db which store information important for the thread to run.
Usually when multi-threading I must check for synchronization so I want to share the same resource at the same time, but do I have to do the same with mysql?
I’m using innodb which locks the row when using it, and I don’t know if I need to look the access to it in my code too.
To my understanding it doesn’t matter if I do it or not because the server it self manage its connection but again I’m not sure.
Connections in java are not guaranteed to be thread safe.In addition to that, Mysql (and innodb in particular) can handle multiple connections safely.
In a comment to you question (by Emil Vikström), solutions are proposed to your problem;
(Edit) and I quote: