I’ve made a java program in netbeans which executes different queries in my database. I have a problem when I add data in the tables. It inserts data in the first 2 tables but not in the third one too. Here’s the code:
String sql="INSERT INTO `adresa` (`ID` ,`TARA` ,`JUDET` ,`LOC` ,`CPOSTAL` ,`STRADA` ,`NR` ,`BLOC` ,`SC` ,`APT`) VALUES (?,?,?,?,?,?,?,?,?,?)";
pst=conn.prepareStatement(sql);
pst.setString(1, ID.getText());
pst.setString(2, tara.getText());
pst.setString(3, judet.getText());
pst.setString(4, loc.getText());
pst.setString(5, cpostal.getText());
pst.setString(6, strada.getText());
pst.setString(7, nr.getText());
pst.setString(8, bloc.getText());
pst.setString(9, sc.getText());
pst.setString(10, apt.getText());
pst.execute();
String sql2="INSERT INTO `pbd`.`buletin` (`CNP` ,`DATAN` ,`SEX` ,`SERIENRB` ,`DATAEMIT` ,`DATAEXP`) VALUES (?,?,?,?,?,?);";
pst.setString(1, CNP.getText());
pst.setString(2, datan.getText());
pst.setString(3, sex.getText());
pst.setString(4, serienrb.getText());
pst.setString(5, dataemit.getText());
pst.setString(6, dataexp.getText());
pst.executeBatch();
String sql3="INSERT INTO `pbd`.`persoana` (`ID` ,`CNP` ,`NUME` ,`PRENUME` ,`NATIONALITATE` ,`VIU`) VALUES (?,?,?,?,?,?);";
pst.setString(1, ID.getText());
pst.setString(2, CNP.getText());
pst.setString(3, nume.getText());
pst.setString(4, prenume.getText());
pst.setString(5, nationalitate.getText());
pst.setString(6, viu.getText());
pst.executeBatch();
And here are the tables information:

I think the queries are wrong or the concept of the tables but I am not sure. Please tell me what do you think.
You need to change your code for sql2 and sql3 as
executeBatch is irrelevant in this case, it can only be used for different parameter sets of the same SQL.