First off, I wouldn't use XCode to write a Java servlet unless my only other option was TextEdit. It's a decent IDE for Objective C and CoCoa, but there are more than a few IDEs that blow it out of the water for Java web development.
With that said, I think you're on the right track with NetBeans. Personally, I use IntelliJ IDEA, but NetBeans is a great choice, as is Eclipse. You'll probably find more in the way of tutorials and examples if you go with Eclipse, but you seem to be making some progress with NetBeans, so I have a few more pointers given that fact.
Tomcat is nice, but the full version of NetBeans for Java Web Development comes with Sun's Glassfish application server built in. Glassfish is pretty light, and pretty comparable to Tomcat, plus you have the nice integration already in place.
If you're looking for a free database, you'll probably want to grab MySQL and learn how to get it running and connect to it using JDBC. If you are hosting on a Mac, a nice program for this is MAMP. It is a nice little app bundle that lets you easily create and run MySQL DBs on your local box.
There are a lot of configuration steps to coding and deploying a servlet, so I would say you're best bet is to search Google for a Hello World servlet tutorial. Get that running, learn and understand what all the configuration steps mean, and then focus on the actual functionality of your own servlet.
Hope this helps