??????μ??????????????????????????????????????????′???
    

    try {
                    Class.forName("Name Of JDBC").newInstance();
                    Connection conn = DriverManager.getConnection(url?? userid?? password);
                    Log.getInstance().trace("Connected to resultDB.");
                   
                    Statement ps = null;
                            ResultSet rs = null;
                            ps = conn.createStatement();
                            String sqlcmd="";
                            SimpleDateFormat df = new SimpleDateFormat("dd MMM yyyy HH:mm:ss"?? Locale.US);
                          
                            report.append(" ============================Final Report================================== ");
                          
                            int test_no = 0;
                            sqlcmd = "SELECT test_no??min(test_start) start?? max(test_end) end?? max(levelload_start) lv_start?? min(levelload_end) lv_end??" +
                                            "b.name?? sum(vu) vu_num?? a.driver_interval FROM EXECUTION a??Scenarios b?? environment c where a.sc_id=b.sc_id and tester='" + Config.getInstance().tester.trim() +"' and " +
                                            "a.env_id=c.env_id and c.description='"+Config.getInstance().test_env_desc.trim()+"'  group by test_no??b.name??a.driver_interval order by test_no desc fetch first 1 rows only";

                            rs = ps.executeQuery(sqlcmd);
                            if (rs!=null && rs.next())
                                    {
                                       test_no = rs.getInt(1);
                                       test_Start=rs.getTimestamp(2);
                                       test_End=rs.getTimestamp(3);
                                       levelload_Start = rs.getTimestamp(4);
                                       levelload_End = rs.getTimestamp(5);
                                       driver_interval = rs.getInt(8);
                                     
                                     
                                       report.append("----> test started: " + df.format(test_Start)+ " GMT <---- ");
                                       report.append("----> test stopped: " + df.format(test_End)+ " GMT <---- ");
                                       report.append("----> VU: " + rs.getInt(7)
                                                            + " <---- ");
                                     
                                       report.append("----> Duration: " + (test_End.getTime()-test_Start.getTime()) + " millisecond <---- ");
                                       report.append("----> Scenario: " + rs.getString(6)
                                                            + " <---- ");
                                     
                                    }
                            else {
                                    System.out.println("Could not find relative execution record by info in qaToolConfig.properties. ");
                                    System.exit(0);
                            }
                          
                            //Get Case info
                            sqlcmd = "select a.case_id??a.case_name??a.description from caseinfo a?? execution b where a.exec_id=b.exec_id and b.test_no=" + test_no +" order by a.case_id";
                          
                            rs = ps.executeQuery(sqlcmd);
                                  
                            while(rs.next()) {
                                    caseID_List.add(rs.getString(1));
                                    caseName_List.add(rs.getString(2)+":"+rs.getString(3));
                            }
                          
                            report.append("----> Test Case Num: " + caseID_List.size() + " <---- ");
                            report.append("----> the whole performance statistics <---- ");
                          
                    sqlcmd = "select res.case_id?? trunc(timestampdiff(2??char(res.ts - exec.ts_start))/exec.driver_interval?? 0)+1 seq?? sum(loop_count) l_cnt?? " +
                         "avg(avg) l_avg?? min(min) l_min?? max(max) l_max?? sum(error_count) err_cnt?? sum(exe_count) exe_cnt?? sum(total_sleeptime) slp " +
                         "from(select a.test_start +( (b.interval_seq-1)*a.driver_interval) seconds ts??b.case_id??b.interval_seq " +
                         "from execution a?? tresult b where a.exec_id=b.exec_id and a.test_no="+test_no+" ) res??" +
                         "(SELECT test_no?? min(test_start) ts_start?? max(test_end) ts_end?? driver_interval FROM EXECUTION " +
                         "where test_no=" + test_no+"  group by test_no??driver_interval) exec??" +
                         "tresult where res.case_id = tresult.case_id and res.interval_seq=tresult.interval_seq " +
                         "group by res.case_id?? trunc(timestampdiff(2??char(res.ts - exec.ts_start))/exec.driver_interval?? 0) ";
                   
                    //System.out.println(sqlcmd);
                    rs = ps.executeQuery(sqlcmd);
                    int case_id = -1;
                   
                    while(rs.next()) {
                          
                            int temp_id = rs.getInt(1);
                            if (temp_id != case_id)
                            {
                                    case_id = temp_id;
                                    int i=0;
                                    for(;i<caseID_List.size();i++)
                                    {
                                            if(Integer.parseInt(caseID_List.get(i).toString()) == case_id)
                                                    break;
                                    }
                                  
                                    //A new line??
                                    report.append("#=== "+ caseName_List.get(i) + " ======== #Interval_Seq Loop_Cnt Avg Min Max Sleep Err_Cnt Exe_Cnt ");
                            }
                          
                            report.append(rs.getString(2) + " " + rs.getString(3) + " " + rs.getString(4)
                                            + " " + rs.getString(5)+ " " + rs.getString(6)+ " " + rs.getString(9) +" "+ rs.getString(7)
                                            + " " + rs.getString(8) +" ");
                    }