Programmer en java

[Résolu]
Signaler
Messages postés
7
Date d'inscription
mardi 6 mars 2012
Statut
Membre
Dernière intervention
2 juin 2012
-
Messages postés
7
Date d'inscription
mardi 6 mars 2012
Statut
Membre
Dernière intervention
2 juin 2012
-
Bonjour
Je travail sur netbeans je créer mon base de donné sur Easyphp je fais mon connexion entre ces dernières les commandes sql se marche bien mais dans l'interface graphique ne marche rien toujours la même message qui s'affiche "erreur base de donnée"
et voila mon code
private void formWindowOpened(java.awt.event.WindowEvent evt) {
try
{
String driver = "com.mysql.jdbc.Driver";
Class.forName(driver).newInstance();
String db= "jdbc:mysql://localhost:3306/projet";
String login = "root";
String password = "";
con = DriverManager.getConnection(db,login,password);
st = con.createStatement();
//ch1 = jTextField1.getText();




}
catch(Exception ex)
{
}

}
c'est pour la connexion à ma base et pour l’action sur le bouton on a :
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
String ch1 = jTextField1.getText();
String ch2 = jPasswordField1.getText();
String ch3 = (String) jComboBox1.getSelectedItem();

String sql "SELECT login, mot_passe, domaine frome Compte where login '" +ch1 +"' mot_passe ='"+ch2+"'domaine ='"+ch3+"'" ;

rs = st.executeQuery(sql);
int count = 0;
while (rs.next()){
count = count+1;

}
if (count==1)
{
int2 f = new int2();
f.setVisible(true);

this.setVisible(false);

}
else
{
JOptionPane.showMessageDialog(null,"login ou mot de passe incorrecte");
jTextField1.setText("");
jPasswordField1.setText("");
}




}
catch (Exception ex) {
JOptionPane.showMessageDialog(null,"erreur base de donnée");
jTextField1.setText("");
jPasswordField1.setText("");


}
}
toujours la memme message que s'affiche " erreur base de donnéé" malgré que les commande sql se marche bien
j'attends vos réponses le plutôt possible
Merci d'avance ;)

2 réponses


Salut,

Ajoute
e.printStackTrace();
pour avoir un maximum de détails sur l'erreur:


} 
catch (Exception ex) {
e.printStackTrace(); 
JOptionPane.showMessageDialog(null,"erreur base de donnée"); 
jTextField1.setText(""); 
jPasswordField1.setText(""); 


Cordialement,

...\ Dan /...
Messages postés
7
Date d'inscription
mardi 6 mars 2012
Statut
Membre
Dernière intervention
2 juin 2012

Merci pour votre reponse
J'ajoute votre code et voila l'affichage des erreurs, malgré que je ne rien compris :'(

Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented
at e.printStackTrace(e.java:13)
at int1.jButton1MouseClicked(int1.java:182)
at int1.access$100(int1.java:23)
at int1$2.mouseClicked(int1.java:70)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3995)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented
at e.printStackTrace(e.java:13)
at int1.jButton1MouseClicked(int1.java:182)
at int1.access$100(int1.java:23)
at int1$2.mouseClicked(int1.java:70)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3995)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented
at e.printStackTrace(e.java:13)
at int1.jButton1MouseClicked(int1.java:182)
at int1.access$100(int1.java:23)
at int1$2.mouseClicked(int1.java:70)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3995)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented
at e.printStackTrace(e.java:13)
at int1.jButton1MouseClicked(int1.java:182)
at int1.access$100(int1.java:23)
at int1$2.mouseClicked(int1.java:70)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3995)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented
at e.printStackTrace(e.java:13)
at int1.jButton1MouseClicked(int1.java:182)
at int1.access$100(int1.java:23)
at int1$2.mouseClicked(int1.java:70)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3995)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

j'attends votre aide et merci d'avance ^_^