Your error is on line 73:
birthyear = Integer.parseInt(request.getParameter("birthyear"));
I’m guessing by your code that the form in the doGet function is the form posting the data you want to store in your database. Your form doesn’t contain a birthyear field. Its absence makes request.getParameter(“birthyear”) return null, which causes a NullPointerException when trying to parse an int from it.
Furthermore, you should not only prepare your statement, but execute it as well:
PreparedStatement pst = connection.prepareStatement(sql);
pst.setInt(1, agentid);
pst.setInt(2, birthyear);
pst.setString(3, familyname);
pst.setString(4, givenname);
// add this line
pst.executeUpdate();
6
solved Inserting data into the PostgreSQL from Java Servlet