Is MySQL Connector/JDBC thread safe?

前端 未结 3 612
花落未央
花落未央 2020-12-10 03:16

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. Ar

3条回答
  •  隐瞒了意图╮
    2020-12-10 03:58

    Transactions are started / committed per connection. Unless you're doing some very specific stuff (I can't really think of an example where that would be justified to be honest), you're better off with a connection pool and connection per thread.

提交回复
热议问题