I have a static method where I pass some parameters and it does db manipulations, returning some resultset. Do I need to synchronize this method to make it thread safe? It does not use any other variables. It only uses local variables passed as method parameters.
You could get into trouble if two threads are using the same Connection at the same time (at least I had this problem with an Oracle database), espececially if autocommit is turned off and both thread try to perform several operations before calling commit(). Also, if one thread is looping through a ResultSet and another thread makes a query using the same Statement (or PreparedStatement), the first ResultSet gets screwed up.