Programmer en java [Résolu]

Messages postés
7
Date d'inscription
mardi 6 mars 2012
Dernière intervention
2 juin 2012
- - Dernière réponse : Marwatita
Messages postés
7
Date d'inscription
mardi 6 mars 2012
Dernière intervention
2 juin 2012
- 17 mars 2012 à 12:58
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 ;)
Afficher la suite 

Votre réponse

2 réponses

Meilleure réponse
3
Merci
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 /...

Dire « Merci » 3

Quelques mots de remerciements seront grandement appréciés. Ajouter un commentaire

Codes Sources 119 internautes nous ont dit merci ce mois-ci

Commenter la réponse de Utilisateur anonyme
Messages postés
7
Date d'inscription
mardi 6 mars 2012
Dernière intervention
2 juin 2012
3
Merci
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 ^_^

Dire « Merci » 3

Quelques mots de remerciements seront grandement appréciés. Ajouter un commentaire

Codes Sources 119 internautes nous ont dit merci ce mois-ci

Commenter la réponse de Marwatita

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.