Reusing a PreparedStatement

前端 未结 1 1589
夕颜
夕颜 2021-01-13 14:12

I ran findbugs on our code base and it pointed out there are two more Statements that still need to be closed. In this section of the code we run:

preparedS         


        
相关标签:
1条回答
  • 2021-01-13 14:34

    Yes, the statement must be closed before you perform the next connection.prepareStatement. Otherwise, you're losing your reference to the un-closed previous one (aka leaking statements). Wrap a try {} finally {} around each statement use, closing it in the finally.

    0 讨论(0)
提交回复
热议问题