Prepared Statements along with Connection Pooling

后端 未结 5 1356
走了就别回头了
走了就别回头了 2021-01-02 14:33

I have a question regarding general use of Prepared Statement along with connection pooling.

Prepared Statements are generally tied to one connection only.In our app

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-02 14:58

    This sounds like an unusual way to use your connection pool. Even though the connections are in a pool, they should only be used by one thread at a time. I tend to create the prepared statement and use it very close to the point of creation. Also, some JDBC drivers now support Statement caching which reduces the overhead of using it in this way.

提交回复
热议问题