Where to close java PreparedStatements and ResultSets?

后端 未结 13 2149
忘了有多久
忘了有多久 2020-11-29 02:26

Consider the code:

PreparedStatement ps = null;
ResultSet rs = null;
try {
  ps = conn.createStatement(myQueryString);
  rs = ps.executeQuery();
  // process         


        
相关标签:
13条回答
  • 2020-11-29 03:07

    Do no omit calling close. It may cause problems.

    I prefer adding try/catch block to the finally.

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