Page 876 - 3-2
P. 876

where detector = "+sparknum+";";
                                    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{
                                            if(conn!=null)
                                                    conn.close();
                                    }catch(SQLException se){
                                            se.printStackTrace();
                                    }
                            }


              }


              public static void gas() {
                      Connection conn = null;
                            Statement stmt = null;
                            try{
                                    Class.forName(JDBC_DRIVER);
                                    conn = DriverManager.getConnection
                                                                    (DB_URL,USERNAME,PASSWORD);
                                    stmt = conn.createStatement();
                                    //System.out.println("gas");
                                    //System.out.println("gas = " + gas + ", gasnum = " + gasnum);
                                    String sql;
                                    sql = "update project set gas = '"+gas+"'
                                                                    where detector = "+gasnum+";";
                                    int rs = stmt.executeUpdate(sql);
                                    //rs.close();
                                    stmt.close();
                                    conn.close();
                            }catch(SQLException se1){
                                    se1.printStackTrace();
                            }catch(Exception ex){


                                                         - 876 -
   871   872   873   874   875   876   877   878   879   880   881