"is java.sql.connection thread safe?" Code Answer

5

if the jdbc driver is spec-compliant, then technically yes, the object is thread-safe, but you should avoid sharing connections between threads, since the activity on the connection will mean that only one thread will be able to do anything at a time.

you should use a connection pool (like apache commons dbcp) to ensure that each thread gets its own connection.

By Will Ricketts on May 20 2022

Answers related to “is java.sql.connection thread safe?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.