public boolean validationCategory (String chargeCategory) {

        Statement statement = null;

        try {

            statement = connection.createStatement();
            statement.execute("select category from categories");

            ResultSet set = statement.getResultSet();
            while(set.next()){
                String cat = set.getString("category");
                if (cat.equals(chargeCategory))  {
                    return true;
                }
            }

        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if(statement != null){
                try {
                    statement.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
        System.out.println("Выбрана неверная категория затрат");
        return false;
    }