title: jdbc consume too much memory
body: <p>I wrote program in that I need to update 10000. The query is:</p>
  
  <pre><code>   for (Ticket ticket : existInBoth) {
          if (!ticket.isUpdatable() &amp;&amp; !ticket.isDeleted()) continue;
          String query = String.format("update tickets SET vehicle_id = %d , price = %d , free = %d,time = '%s',date='%s',url='%s',deleted_at=NULL  WHERE unique_key = '%s'",
                  ticket.getVehicle().getId(), ticket.getPrice(), ticket.getFree(), ticket.getTime(), ticket.getDate(), ticket.getUrl(), ticket.getUniqueKey());
          if (db.update(query) &gt; 0)
              updatedDates.add(ticket.getDate());    
  
      }
  </code></pre>
  
  <p>and db.update</p>
  
  <pre><code>    @Override
  public int update(String sql) {
      synchronized (Main.THREAD_GUARD) {
          int result = -1;
          Connection connection = open();
          try {
              Statement statement = connection.createStatement();
              result = statement.executeUpdate(sql);
              statement.close();
          } catch (SQLException e) {
              e.printStackTrace();
          } finally {
              close(connection);
          }
          return result;
      }
  }
  </code></pre>
  
  <p>It seems realy easy. But when I ran it I see this updating take about 300MB of memory.</p>
  
  <p>I carefully close all statements and connections.</p>