public void startProcess(File output, final String drugName) throws Exception {
    logger.info("GenOutputNew");

    if (output.exists()) {
      throw new Exception("Output file already exists.");
    }

    PrintWriter pw = new PrintWriter(output);

    // Connect
    DBClient.getInstance().connect();
    Connection con = DBClient.getInstance().getConnection();

    PreparedStatement pstmtSelectSideEffects = con
        .prepareStatement("SELECT * FROM specific_drug_side_effects WHERE type=?");
    pstmtSelectSideEffects.setString(1, drugName);
    ResultSet rsSideEffects = pstmtSelectSideEffects.executeQuery();

    Set<String> symptoms = new HashSet<String>();
    while (rsSideEffects.next()) {
      String symptom = rsSideEffects.getString("symptom");
      if (symptom.trim().isEmpty()) {
        continue;
      }
      symptoms.add(symptom);
    }
    rsSideEffects.close();
    pstmtSelectSideEffects.close();

    pstmtSelectSideEffects = con
        .prepareStatement("SELECT * FROM specific_drug_side_effects WHERE type=? AND symptom=?");
    for (String symptom : symptoms) {
      pstmtSelectSideEffects.setString(1, drugName);
      pstmtSelectSideEffects.setString(2, symptom);
      ResultSet rsSymptomSideEffects = pstmtSelectSideEffects.executeQuery();

      double pi = 1.0;
      String isMoreCommon = "N";
      while (rsSymptomSideEffects.next()) {
        int authorId = rsSideEffects.getInt("author_id");
        int docId = rsSideEffects.getInt("doc_id");
        int frequency = rsSideEffects.getInt("frequency");
        isMoreCommon = rsSideEffects.getString("is_more_common").trim();

        double sigma = 0.0;
        sigma += getAffectiveFeatures(con, authorId, docId) * frequency;
        sigma += getStylisticFeatures(con, authorId, docId) * frequency;
        sigma += getUserFeatures(con, authorId) * frequency;
        pi *= Math.exp(sigma);
      }

      pw.println(isMoreCommon + "\t" + pi);
      rsSymptomSideEffects.close();
    }

    pw.close();
  }