Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is MySQL Connector/JDBC thread safe?

Tags:

People also ask

Is MySQL Connector thread-safe?

It is not thread-safe, so call it before threads are created, or protect the call with a mutex.

Are JDBC connections thread-safe?

The PostgreSQL™ JDBC driver is thread safe. Consequently, if your application uses multiple threads then you do not have to worry about complex algorithms to ensure that only one thread uses the database at a time.

Is JDBC single threaded?

JDBC allows you to share a single Connection among multiple threads.


Is the standard MySQL JDBC driver thread-safe? Specifically I want to use a single connection across all threads, but each statement will only be used in a single thread. Are there certain scenarios that are safe and others that aren't? What's your experience here?