ExecuteQuery

Résolu
Bonjour,
j'ai une erreur au niveau de executeQuery je n'rrive pas a l'utilisé voila mon code
ResultSet rs = st.executeQuery("select * from personne ");
j'ai une erreur genre cannot find symbol
merci
Configuration: Windows XP
Internet Explorer 7.0

7 réponses

  1. c'est bon ca marche
    j'ai du importer java.sql.statement; au lieu de java.beans.statement
    merci encore une fois
    1. moi j'ai se erreur : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table' at line 1.

      voici la requte ResultSet res=stm.executeQuery("select * from table ");

      j'utilise Class.forName("com.mysql.jdbc.Driver");
      1. Il faudrait l'erreur exact et le code entourant cette requête s'il vous plaît
        1. voila le code de ma classe
          public class ConnexionPersonne {

          public static void main(String[] args) {
          try{
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          Connection con = DriverManager.getConnection("jdbc:odbc:source);
          Statement st = con.createStatement();
          ResultSet rs = st.executeQuery("select * from personne ");
          while (rs.next()) {
          System.out.println(rs.getString(1));

          }
          con.close();
          }
          catch (Exception e) {
          }

          }

          }
          et voila l'erreur
          connot find Symbol
          symbol:method executeQuery
          location:class java.beans.statement
          incompatible types
          found : java.beans.statement.executeQuery
          required:java.sql.resulset
          1. essayez ceci
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

            à part ça je ne vois rien d'inhabituel :s
        2. Je pense que le nom "table" pour est interdit, il faudrait que tu renommes cette table dans ta bdd.