Skip to content
Oleh Astappiev edited this page Oct 16, 2023 · 1 revision

Java

Use the auto close feature to make sure that statements are closed:

try(PreparedStatement select = learnweb.getConnection().prepareStatement("SELECT ...");)
{
  select.setInt(1, groupId);
  ResultSet rs = select.executeQuery();
  while(rs.next())
  ....
}

Try without catch in this case. Because most errors must be catched in the beans to allow notification of users.

Clone this wiki locally