Bonjour,
J'ai crée une application Swing.
Quand je crée ma table, une boite de dialogue apparait indiquant que ma table est crée mais je ne trouve rien dans ma base de données, sachant que tout est nickel au niveau de la connexion.
Voilà mon interface :
et quand je veux insérer une ligne, il m'indique l'erreur suivante
et voilà mon code Java :java.sql.SQLException: ORA-00942: Table ou vue inexistante
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:210)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:961)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1657)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1626)
at javaapplication5.oraInterface$5.actionPerformed(oraInterface.java:231)
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:6504)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6269)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4860)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4686)
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:2713)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
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:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Quelqu'un saurait-il m'indiquer comment résoudre ce problème ?
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115 jButton1.setText("Create"); jButton1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { if (jTextField1.getText() == null || jTextField1.getText().trim().length() == 0) { JOptionPane.showMessageDialog(jPanel1, "Please input the table name!"); return; } Pattern p = Pattern.compile("[a-zA-Z0-9]+"); Matcher m = p.matcher(jTextField1.getText().trim()); if(!m.matches()) { JOptionPane.showMessageDialog(jPanel1, "Error table name,please retry!"); return; } // Statement s = con.createStatement( // ResultSet.TYPE_SCROLL_SENSITIVE, // ResultSet.CONCUR_UPDATABLE); String temp = createText1 + " "; temp += jTextField1.getText().trim(); temp = temp + " (" + jTextArea1.getText() + ") "; String textArea = jTextArea1.getText().trim(); temp = temp + "PARTITION BY HASH(" + textArea.substring(0, textArea.indexOf(" ")) + ") \n PARTITIONS 4 \n STORE IN (ts1, ts2, ts3, ts4)"; System.out.println(temp); // s.execute(temp); // s.close(); JOptionPane .showMessageDialog(jPanel1, "Create successful!"); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); jLabel6.setText("ColumnName:"); jLabel8.setText("Value:"); jButton3.setText("Add"); jButton3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String temp = ""; if (jTextArea2.getText() != null && jTextArea2.getText().trim().length() != 0) { temp = jTextArea2.getText() + "\n"; } temp = temp + jTextField5.getText() + ":" + jTextField7.getText(); jTextArea2.setText(temp); jTextField5.setText(""); jTextField7.setText(""); } }); jTextArea2.setColumns(20); jTextArea2.setRows(5); jScrollPane2.setViewportView(jTextArea2); jButton4.setText("Insert"); jButton4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { if (jTextField1.getText() == null || jTextField1.getText().trim().length() == 0) { JOptionPane.showMessageDialog(jPanel1, "Please input the table name!"); return; } Statement stmt = con.createStatement(); String temp = "insert into " + jTextField1.getText().trim() + "("; String textArea = jTextArea2.getText(); String[] textarray = textArea.split("\n"); for (int i = 0; i < textarray.length; i++) { temp = temp + textarray[i].split(":")[0] + ", "; } temp = temp.substring(0, temp.length() - 2); temp += ") values("; for (int i = 0; i < textarray.length; i++) { temp = temp + textarray[i].split(":")[1] + ", "; } temp = temp.substring(0, temp.length() - 2); temp += ")"; System.out.println(temp); stmt.executeUpdate(temp); stmt.close(); JOptionPane.showMessageDialog(jPanel2, "Insert successul!"); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } });
Merci d'avance pour votre éventuel aide
Partager