This is the error my program is giving. java.sql.SQLException: ORA-00001: unique constraint (SYSTEM.SYS_C006997) violated
I tried the following code still the error message in JOptionPane is not "User Exists" ..How can i do that? And also do i need to execute commit statement from my program to save the tables created in oracle db ?
try {
Statement stmt = con.createStatement();
stmt.executeUpdate("insert into users values('"+st1+"','"+st2+"')");
JOptionPane.showMessageDialog(null,"User Added","Message",JOptionPane.INFORMATION_MESSAGE);
setVisible(false);
src.addusr.main(null);
}
catch(SQLIntegrityConstraintViolationException e)
{
JOptionPane.showMessageDialog(null,"User Already Exists","Message",JOptionPane.ERROR_MESSAGE);
}
catch(SQLException e2) {
JOptionPane.showMessageDialog(null,e2.getMessage(),"Message",JOptionPane.ERROR_MESSAGE);
e2.printStackTrace();
}
try {
Statement stmt1 = con.createStatement();
stmt1.executeUpdate("commit");
}
catch(SQLException e6) {
e6.printStackTrace();
}
}