public PreparedStatement prepareStmtWithParameters(Connection dbConn, String sql, List<String> parameters)
      throws SQLException {
    PreparedStatement pst = dbConn.prepareStatement(addEscapeCharacters(sql));
    if ((parameters == null) || parameters.isEmpty()) {
      return pst;
    }
    try {
      for (int i = 1; i <= parameters.size(); i++) {
        pst.setString(i, parameters.get(i - 1));
      }
    } catch (SQLException e) {
      pst.close();
      throw e;
    }
    return pst;
  }
Make PreparedStatement object with list of String type parameters to be set.
It is assumed the input sql string have the number of "?" equal to number of parameters
passed as input.
@param dbConn - Connection object
@param sql - SQL statement with "?" for input parameters.
@param parameters - List of String type parameters to be set in PreparedStatement object
@return PreparedStatement type object
@throws SQLException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/SQLGenerator.java