public void flush() throws SQLException {
    
      //Load up JDBC.
      try {
        Class.forName("org.sqlite.JDBC");
      }
      catch (ClassNotFoundException e) {
        e.printStackTrace();
        return;
      }

      //Set up a command to select all pertinent columns:
      String command = "SELECT * FROM alphabet WHERE token IN (";

      for (Enumeration<String> keys = buffer.keys(); keys.hasMoreElements();) {
        command += "'" + keys.nextElement() + (keys.hasMoreElements() ? "', " : "')");
      }
      System.out.println(command);
      //Open a connection
      connection = DriverManager.getConnection("jdbc:sqlite:" + dbPath);
      
      //Make a query to that connection for pertinent rows:
      Statement statement = connection.createStatement();
      boolean hasNoElements = false;
      ResultSet testResults = null;
      try{
        testResults = statement.executeQuery(command);
      }
      catch(Exception e){
        hasNoElements = true;
      }
      finally{
        testResults.close();
      }
      if (!hasNoElements){
        ResultSet results = statement.executeQuery(command);
        //Add our counts to the existent counts and empty the hashtable as we move:
        while (results.next()) {
          String name = results.getString("token");
          String[] exec = new String[]{"UPDATE alphabet SET count = "+(results.getInt("count")+buffer.get(name))+" WHERE token = '"+name+"'"};
          System.out.println(exec[0]);
          statement.executeUpdate(exec[0]);
          buffer.remove(name);
        }
        
      }
      //Any values that were not emptied (are not already in the table), we should add:
      for (Enumeration<String> keys = buffer.keys(); keys.hasMoreElements();) {
        String key = keys.nextElement();
        statement.executeUpdate("INSERT INTO alphabet VALUES ('" + key + "'," + buffer.get(key) + ")");
        buffer.remove(key);
      }
      buffer.clear();
      System.out.println(buffer.size());
      statement.close();
      connection.close();
    }