try {
pst=con.prepareStatement("insert into stud values(?,?,?,?,?,?,?,?,?)");
pst.setString(1,s1);
pst.setString(2,s2);
pst.setString(3,s3);
pst.setString(4,s4);
pst.setString(5,s5);
pst.setString(6,s6);
pst.setString(7,s7);
pst.setString(8,s8);
pst.setString(9,s9);
int val=pst.executeUpdate();
con.commit();
con.close();
} catch(SQLException e) {
System.out.println("except1");
}
This code gives the error "except1" which means it doesn't insert values in the database. Is something wrong with the SQL insert statement? The table stud
is in the database.