JDBC garbage collection

前端 未结 5 830
傲寒
傲寒 2020-12-19 20:26

What happens if i don\'t close resultset or preparedstatements.

Will they be closed and released by the garbage collector.

I\'m asking this for local variabl

5条回答
  •  余生分开走
    2020-12-19 20:54

    I am not an expert here, but I don't think GC can collect that as PSs are associated with database connections, so that won't get garbage collected. Yo can have a look here: http://www.theserverside.com/news/1365244/Why-Prepared-Statements-are-important-and-how-to-use-them-properly

提交回复
热议问题