who was casted for the title role?
The cast are Tobey Maguire alongside Kirsten Dunst, James Franco, Alfred Molina, Rosemary Harris, and Donna Murphy.
Spider-Man 2
Spider-Man 2 is a 2004 American superhero film directed by Sam Raimi and written by Alvin Sargent from a story by Alfred Gough, Miles Millar and Michael Chabon. Based on the fictional Marvel Comics character of the same name, it is the second installment in the "Spider-Man" trilogy and a sequel to 2002's "Spider-Man" film, starring Tobey Maguire alongside Kirsten Dunst, James Franco, Alfred Molina, Rosemary Harris, and Donna Murphy. 

when did the second spider man movie come out In 2004.
wiki:13082401
Spider-Man 2 [SEP] Introduction
Meanwhile, Dr. Otto Octavius becomes a diabolical villain after a failed experiment kills his wife and leaves him neurologically fused to mechanical tentacles. Spider-Man must stop him from successfully recreating the dangerous experiment, while dealing with a subconscious desire to stop being Spider-Man that is stripping him of his powers. Raimi's inspiration for the film came from the comic book debut of Doctor Octopus in 1964, the 1966 story arc "If This Be My Destiny...!", and the 1967 story arc "Spider-Man No More!". Principal photography began in April 2003 in New York City and also took place in Los Angeles.