Page 878 - 3-2
P. 878

}catch(SQLException se){
                                            se.printStackTrace();
                                    }
                            }
              }


              public static void fire() {
                      if(fire==1)
                              {
                              sendAll(firenum+"_cool_on");
                      sendAll(firenum+"_sp_on");
                      sendAll(firenum+"_temp_on");
                              }
                      else {
                              sendAll(firenum+"_cool_off");
                      sendAll(firenum+"_sp_off");
                      sendAll(firenum+"_temp_off");
                              }


                      Connection conn = null;
                            Statement stmt = null;
                            try{
                                    Class.forName(JDBC_DRIVER);
                                    conn = DriverManager.getConnection
                                                            (DB_URL,USERNAME,PASSWORD);
                                    stmt = conn.createStatement();
                                    //System.out.println("temp");
                                    String sql;
                                    sql = "update project set fire = "+fire+"
                                                                    where detector = "+firenum+";";
                                    int rs = stmt.executeUpdate(sql);
                                    //rs.close();
                                    stmt.close();
                                    conn.close();
                            }catch(SQLException se1){
                                    se1.printStackTrace();
                            }catch(Exception ex){
                                    ex.printStackTrace();
                            }finally{
                                    try{
                                            if(stmt!=null)
                                                    stmt.close();
                                    }catch(SQLException se2){
                                    }
                                    try{


                                                         - 878 -
   873   874   875   876   877   878   879   880   881   882   883