@FXML private void DeleteButtonAction(ActionEvent event) throws IOException { //alterar conection! String myDriver = "org.gjt.mm.mysql.Driver"; String myUrl = "jdbc:mysql://localhost/test"; Class.forName(myDriver); Connection conn = DriverManager.getConnection(myUrl, "root", ""); //alterar table name String SQL = "DELETE FROM department WHERE dept_no = ? "; PreparedStatement pstmt = null; // get a connection and then in your try catch for executing your delete... pstmt = con.prepareStatement(SQL); pstmt.setString(1, Integer.parseInt(textfield.getText())); pstmt.executeUpdate(); conn.close(); }