try catch block not work in action performed

Joined
Jun 14, 2017
Messages
1
Reaction score
0
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton1ActionPerformed


try {
Class.forName("oracle.jdbc.driver.OracleDriver");
JOptionPane.showMessageDialog(null, "Class Loaded");
Connection conn = DriverManager.getConnection("jdbc:eek:racle:thin:mad:localhost:1521:xe", "midos", "mido");
JOptionPane.showMessageDialog(null, "connection Succeded");
PreparedStatement stmt=conn.prepareStatement("insert into empl(id ,name,salary) values('"+t_id+"','"+t_name+"','"+t_Sal+"')");
int c= stmt.executeUpdate();
if (c>0)JOptionPane.showMessageDialog(null, "Data Updated");
conn.close();
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
}
}
 
Joined
Apr 25, 2017
Messages
247
Reaction score
31
What did you mean by not working ? You are not adding any code inside catch method.

Try add some code inside catch block and see what the result is.
Java:
catch (ClassNotFoundException e) {
       e.printStackTrace(); // add this line
}
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top