public Object scalar() //to fetch single value
       {
            ResultSet rs=null;
            Object s=null;
            try {
                rs=ps.executeQuery();
               
                if(rs.next())
                  {
                   s=rs.getObject(1);
                  }
            }catch(Exception ex){
                System.err.println(ex);
            }finally{
               try{
                  if(rs!=null)
                     rs.close();
               }catch(Exception ex) {
                  System.err.println(ex);
               }
               try{
                if(ps.getConnection()!=null)
                   ps.getConnection().close();
                }catch(Exception ex) {
                   System.err.println(ex);
                }
               try{
                if(ps!=null)
                   ps.close();
                }catch(Exception ex){
                   System.err.println(ex);
                }
           }
           return s;
        }