Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2747 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  cnx sqlserver et eclipse

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

cnx sqlserver et eclipse

n°2192237
chimo01
Posté le 30-05-2013 à 14:45:12  profilanswer
 

bonjour,
 
j'ai pas réussie à faire la connexion de sqlserver express avec eclipse
 
voici mon essai sachant que Server name : HP\SQLEXPRESS
                                      Authentification : Windows Authentification
 

Code :
  1. private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) throws ClassNotFoundException {// GEN-FIRST:event_jButton3ActionPerformed
  2.  lb4.setText("" );
  3.  try {
  4.   Class.forName ("com.microsoft.jdbc.sqlserver.SQLServerDriver" );
  5.   Connection connection = DriverManager.getConnection("jdbc:sqlserver://localhost;databaseName=pfe;IntegratedSecurity=true;" );
  6.   Statement st = connection.createStatement();
  7.   String req = "select login , password from utilisateur";
  8.   ResultSet rs = st.executeQuery(req);
  9.   String log = tf1.getText();
  10.   char[] pass = tf2.getPassword();
  11.   while (rs.next()) {
  12.    if ((log.equals(rs.getString("login" )))
  13.      && (Arrays.equals(pass, rs.getString("password" )
  14.        .toCharArray()))) {
  15.     MainFrame mf = new MainFrame();
  16.            mf.setLocationRelativeTo(null);
  17.            mf.setVisible(true);
  18.            dispose();
  19.    } else {
  20.     lb4.setText("Authentification echouée !!" );
  21.     tf1.setText("" );
  22.     tf2.setText("" );
  23.    }
  24.   }
  25.   st.close();
  26.   connection.close();
  27.  } catch (SQLException sqle) {
  28.   JOptionPane.showMessageDialog(null, "Connexion à  la base echouée",
  29.     "Erreur", JOptionPane.ERROR_MESSAGE);
  30.  }
  31. }


 
voici le message d'erreur:
 
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Unknown Source)
 at GUI.Identification.jButton3ActionPerformed(Identification.java:173)
 at GUI.Identification.access$3(Identification.java:167)
 at GUI.Identification$4.actionPerformed(Identification.java:79)
 at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
 at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
 at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
 at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
 at java.awt.Component.processMouseEvent(Unknown Source)
 at javax.swing.JComponent.processMouseEvent(Unknown Source)
 at java.awt.Component.processEvent(Unknown Source)
 at java.awt.Container.processEvent(Unknown Source)
 at java.awt.Component.dispatchEventImpl(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Window.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
 at java.awt.EventQueue.access$200(Unknown Source)
 at java.awt.EventQueue$3.run(Unknown Source)
 at java.awt.EventQueue$3.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
 at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
 at java.awt.EventQueue$4.run(Unknown Source)
 at java.awt.EventQueue$4.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)
 
merci de m'aider SVP  :(


Message édité par chimo01 le 30-05-2013 à 19:55:26
mood
Publicité
Posté le 30-05-2013 à 14:45:12  profilanswer
 

n°2192427
chimo01
Posté le 31-05-2013 à 20:37:07  profilanswer
 

:(


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  cnx sqlserver et eclipse

 

Sujets relatifs
java android eclipseEclipse - message "erreur" EGIT
Impossible de configurer l'interpreteur PyDev/Eclipseproblème éclipse et les variables d'environement
Java Eclipse Classpath et ressourcesSQLSERVER 2005 : procédure stockée à moitié executée
Affichage dans le console d'eclipseoutil UML <---> code c++ pour eclipse-cdt?
Lancer 2 programmes java sous eclipse 
Plus de sujets relatifs à : cnx sqlserver et eclipse


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR