IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JDBC Java Discussion :

Eclipse + access


Sujet :

JDBC Java

  1. #1
    Membre averti
    Inscrit en
    Janvier 2008
    Messages
    50
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 50
    Par défaut Eclipse + access
    Slt,

    je travaille avec eclipse& accees.
    J'avais un pb au niveau de la connexion de l'ai résolu.
    Mais la je dois insérer des valeur ds la base et j'ai un pb!!!

    Voila le code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                connexion = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\kenza.mdb");
                statement = connexion.createStatement();}
            catch (SQLException ex) {ex.printStackTrace();} 
            catch (ClassNotFoundException ex) {ex.printStackTrace();}
        }
     
        public void remplirGrille(ArrayList<Integer> vals)
        {
        int i=2;int j=3;
            valeurs = vals;
            try {int r= statement.executeUpdate("update table1 set x=" + i +", y = " + j + " where valeur = '" + valeurs.get(1) + "';");}
            catch (SQLException ex) {ex.printStackTrace();}
     
            repaint();
        }
    Je reçois ça comme erreur

    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Type de données incompatible dans l'expression du critère.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    at Grille.remplirGrille(Grille.java:44)
    at Test$2.actionPerformed(Test.java:85)
    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.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.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)
    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] Type de données incompatible dans l'expression du critère.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    at Grille.remplirGrille(Grille.java:44)
    at Test$2.actionPerformed(Test.java:86)
    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.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.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 pour votre aide
    @+

  2. #2
    Membre averti
    Inscrit en
    Janvier 2008
    Messages
    50
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 50
    Par défaut
    slt

    est ce que vous pouvez m'aidez S.V.P.

    Merci

  3. #3
    Rédacteur
    Avatar de darrylsite
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    1 299
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 1 299
    Par défaut
    on peut voir la structure de la table1?
    Le probleme vient de ta requete sql.

  4. #4
    Membre averti
    Inscrit en
    Janvier 2008
    Messages
    50
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 50
    Par défaut
    Slt,

    la table est formée de trois colonnes de type numérique( valeur /x/y)
    Merci de m'expliquer je dois faire koi au niveau de la requette

    @+

  5. #5
    Rédacteur
    Avatar de darrylsite
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    1 299
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 1 299
    Par défaut
    Citation Envoyé par kenza28684 Voir le message
    Slt,

    la table est formée de trois colonnes de type numérique( valeur /x/y)
    Merci de m'expliquer je dois faire koi au niveau de la requette

    @+
    Tu as dit trois type numerique, alors que dans la requete, tu essaie de tester valeur de type numerique à un string
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    int r= statement.executeUpdate("update table1 set x=" + i +", y = " + j + " where valeur = '" + valeurs.get(1) + "';");
    Il faut que tu enleves les '
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    int r= statement.executeUpdate("update table1 set x=" + i +", y = " + j + " where valeur = " + valeurs.get(1) + ";");

  6. #6
    Membre averti
    Inscrit en
    Janvier 2008
    Messages
    50
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 50
    Par défaut
    Slt

    merciiiiiiiiiiiiiiii ca marche, c'etait vraiment bete de ma part.

    Est ce que tu peux me donner des liens vers des doc interssants

    Encore merci et
    @+

  7. #7
    Rédacteur
    Avatar de darrylsite
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    1 299
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juillet 2007
    Messages : 1 299
    Par défaut
    Citation Envoyé par kenza28684 Voir le message
    Slt

    merciiiiiiiiiiiiiiii ca marche, c'etait vraiment bete de ma part.

    Est ce que tu peux me donner des liens vers des doc interssants

    Encore merci et
    @+
    On se trompe parfois sur des petites choses.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. org.eclipse.swt.SWTException: Invalid thread access
    Par LordDaedalus dans le forum SWT/JFace
    Réponses: 3
    Dernier message: 12/02/2010, 11h23
  2. Réponses: 5
    Dernier message: 22/10/2009, 21h12
  3. Invalid thread access au démarrage d'Eclipse
    Par raz2008 dans le forum Eclipse
    Réponses: 1
    Dernier message: 26/09/2009, 15h56
  4. Eclipse Lire Table Access
    Par g25452 dans le forum JDBC
    Réponses: 0
    Dernier message: 21/10/2008, 13h19
  5. Eclipse & Access
    Par wiss20000 dans le forum Eclipse Java
    Réponses: 6
    Dernier message: 22/02/2007, 17h25

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo