1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
try {
Connection connection = null;
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);
String serverName = "10.133.0.25";
String portNumber = "1521";
String sid = "fin";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber +":" + sid;
String username = "hhhh";
String password = "hhhh";
connection = DriverManager.getConnection(url, username, password);
Statement instruction = connection.createStatement();
String sql = " select utilisateur, mot_passe from utilisateur where utilisateur ='"+nom+"' and mot_passe ='"+passe1+"' ";
ResultSet resultat = instruction.executeQuery(sql);
while (resultat.next()){
prenom= resultat.getString("utilisateur");
passeword= resultat.getString("mot_passe");
}
if ((prenom.equals(nom))&& (passeword.equals(passe1))) {
menu a =new menu();
a.setVisible(true);
a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
a.setResizable (false);
a.setLocationRelativeTo(null);
setVisible(false);
}
else
{
JOptionPane message = new JOptionPane();
message.showMessageDialog(passe.this, "mot passe ou user erronée ","Erreur",JOptionPane.INFORMATION_MESSAGE);
}
}
catch (Exception ex) {
ex.printStackTrace() ;
} |
Partager