使用javafx连接数据库时出现问题

时间:2019-04-23 18:14:41

标签: javafx netbeans

我是javafx的新手,当我连接到数据库时遇到了严重的问题

例如:

 *
 * @author TOSHIBA
 */
public class authentification {



    //**


      authentification(){


    }

    public boolean authentification(String username,String pass) {

         String sql = "SELECT * FROM administrateur WHERE pseudo = ? and mdp = ?";

         boolean suucess=false;
         try {

             ConnectionClass connectionClass = new ConnectionClass();
             Connection connection = connectionClass.getConnection();
             PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1, username);
             preparedStatement.setString(2, pass);
             ResultSet resultSet = preparedStatement.executeQuery();

             if (!resultSet.next()) {
                 suucess= true;  

           } 
       } catch (Exception e) {
             e.printStackTrace();
         }
        return suucess;


    }
}

1 个答案:

答案 0 :(得分:0)

from datetime import date, timedelta
today = date.today()
last_day_prev_month = today - timedelta(days=today.day)
twenty_prev_month = last_day_prev_month.replace(day=20)
print(twenty_prev_month)  # 2019-03-20