San Jose doesn't do judicial oaths and cannot do name changes as part of naturalization. So, you'll have to spend the money on a court name change.
I would say do it before sending the N-400 or after that. I am not sure how that submitting N-400 with intention to change the name will work, in particular around name check processing. It is probably better if you do it earlier, that way your naturalization certificate will be issued with the new name and will be less paperwork to apply for passport and other documents, as the spelling on the certificate will match the spelling you want on the other documents.
DO : San Jose
11/28/2006 : Mailed
12/04/2006 : PD (and Receive Date)
12/05/2006 : Check cashed
12/11/2006 : Notice Date (Received on the 14th)
12/22/2006 : FP ND
01/09/2007 : FP Appt
12/29/2006 : FP Done. Walk-In
07/17/2007 : Interview (ND May 17)
08/22/2007 : Oath (Received Jul 26, issued on the 23d, mailed on 24th)
08/23/2007 : Applied N-600 and Expedited Passport
09/06/2007 : Passport received
08/20/2008 : Sent N-565 (Approved Feb 17, 2009)