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

avec Java Discussion :

insertion dans oracle 10g xe depuis java


Sujet :

avec Java

  1. #1
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Janvier 2014
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Congo-Kinshasa

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Janvier 2014
    Messages : 1
    Points : 1
    Points
    1
    Par défaut insertion dans oracle 10g xe depuis java
    salut tout le monde.
    je suis nouvelle sur ce forum et je suis débutante en java.
    j'ai un probleme d'insertion des données depuis un swing dans ma table qui se trouve dans la bd par défaut xe de oracle 10g. voici mon 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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.sql.*; 
     
    public class client extends JPanel implements  ActionListener{ JPanel Bou = new JPanel();
    JPanel Boutons = new JPanel();
    JPanel Bouton = new JPanel();
    JButton ok = new JButton("ok");
    JButton annuler = new JButton("annuler");
    JButton client = new JButton("nouveau client");
    JLabel ab1=new JLabel("Nom  ");
    JLabel ab2=new JLabel("Prenom");
    JTextField abonne1=new JTextField(10);
    JTextField abonne2=new JTextField(10);
    JFrame win;
    client(JFrame win){
    this.win=win;
    setLayout(new BorderLayout(40,40));
     
     
    Boutons.add(ok);
    Bouton.add(ab1);
    Bouton.add(abonne1);
     
    Bou.add(ab2);
    Bou.add(abonne2);
    Boutons.add(annuler);
    add(Bouton,BorderLayout.WEST);
    add(Bou,BorderLayout.EAST);
    add(Boutons,BorderLayout.SOUTH);
    ok.addActionListener(this);
     
    annuler.addActionListener(this);
     
     
     }
     
    public void actionPerformed(ActionEvent e)
     {
     
     
    if (e.getSource() == annuler) {
    win.dispose();
    }
     
     
    else if (e.getSource() == ok) {
    String nom1=abonne1.getText();
    String prenom1=abonne2.getText();
     
    Connection conn;
    try {
     
    Class.forName("oracle.jdbc.driver.OracleDriver"); 
    conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "hyposse", "amir"); 
    Statement stmt = conn.createStatement();
    String hyp="insert into Client_Abonne (code,nom,prenom) values (CLIENT.nextval,'"+nom1+"','"+prenom1+"')";
    ResultSet  rset = stmt.executeQuery (hyp);
     
    hyp ="select client.currval from dual";
    int resultSet = stmt.executeUpdate(hyp);
    boolean poi=rset.next();
    String he=rset.getString(1);
     
    JFrame Cade=new JFrame();
      Cade.setContentPane(new code(he,Cade));
     
    Cade.setLocation(280,150);
      Cade.pack();
     
      Cade.setVisible(true);
    win.dispose();
    }
     
    catch (ClassNotFoundException f) { 
       System.err.println("Ne peut trouver la classe du driver de la base de donnees."); 
       f.printStackTrace(); 
      } 
      catch (SQLException f) { 
       System.err.println("Probleme SQL."); 
     
       f.printStackTrace(); 
      }    
    }
    }
    }
    et voici le msg d'exception:

    Probleme SQL.
    java.sql.SQLSyntaxErrorException: ORA-00942: Table ou vue inexistante

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:195)
    at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1036)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
    at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1498)
    at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:406)
    at client.actionPerformed(client.java:64)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6505)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6270)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4861)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4687)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:702)
    at java.awt.EventQueue$4.run(EventQueue.java:700)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
    svp j'ai besoin de votre aide; je suis bloqué pcq apparemment je ne trouve pas d'erreur.

    merci d'avance

  2. #2
    Membre expérimenté Avatar de nathieb
    Homme Profil pro
    DevOps
    Inscrit en
    Mai 2004
    Messages
    1 058
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : DevOps
    Secteur : Service public

    Informations forums :
    Inscription : Mai 2004
    Messages : 1 058
    Points : 1 532
    Points
    1 532
    Par défaut Bonjour
    Bonjour,

    As tu lu tes logs ?
    Il existe la balise code ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    java.sql.SQLSyntaxErrorException: ORA-00942: Table ou vue inexistante
    In english, you're table doesn't exist, je traduis des fois que ... je blague.

    Euh fais t'as requête en SQL mode natif, une solution simple et efficace.

    Olivier
    Architecte destructurant,
    be cool, be free

    Il nous reste Debian bien sûr

Discussions similaires

  1. creer une nouvelle base dans oracle 10g
    Par clement42 dans le forum Oracle
    Réponses: 4
    Dernier message: 02/05/2006, 18h20
  2. [VB6] exécution d'une requete Insert dans oracle 9.2
    Par krest dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 21/04/2006, 13h28
  3. Réponses: 9
    Dernier message: 20/04/2006, 11h07
  4. [Oracle 10g]Insertion multiple, oracle 10g
    Par ViRouF dans le forum Oracle
    Réponses: 6
    Dernier message: 25/02/2006, 07h22
  5. oracle 10g, connexion depuis un client
    Par pioupiouprod dans le forum Oracle
    Réponses: 9
    Dernier message: 11/08/2005, 14h59

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