private void insertDataStaff() { Connection c = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:C:/Users/SRV/Desktop/project8"); // Uses SQL Injection to insert data into Graduate Table String sql = "insert into staff (sid,lastname, firstname, phone, email, office) " + "values (?,?,?,?,?,?)"; PreparedStatement prespstat = c.prepareStatement(sql); for (Staff tmpdata : StaffLst) { prespstat.setString(1, null); prespstat.setString(2, tmpdata.getLastname()); prespstat.setString(3, tmpdata.getFirstname()); prespstat.setInt(4, tmpdata.getPhone()); prespstat.setString(5, tmpdata.getEmail()); prespstat.setInt(6, tmpdata.getOffice()); prespstat.addBatch(); } prespstat.executeBatch(); prespstat.close(); c.close(); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } System.out.println("Database Inserted Successfully"); }