You'll find a good tutorial
here.
I do mine like so:
Some people leave out the null tests, I prefer to do it this way. Always close them in this order; ResultSet first if you have one. If you did an excuteUpdate then of course you didn't get a ResultSet returned to you. Then the Statement whether a Prepared or Callable, and finally the Connection. Remember that the finally block always gets executed whether or not the code throws an exception so this is where cleanup code goes. By doing this you ensure that the objects can be garbage collected.