I am opening a single JDBC connection in my init() method. Do I need to synchronize on the Connection or the Statement object?

Alex Chaffee

You shouldn't have to. If your JDBC driver supports multiple connections, then the various createStatement methods will give you a thread-safe, reentrant, independent Statement that should work OK, even if other requests/threads are also accessing other Statements on the same Connection.

Of course, crossing your fingers never hurts... Many early JDBC drivers were not re-entrant. The modern versions of JDBC drivers should work OK, but there are never any guarantees.

Using connection pooling will avoid the whole issue, plus will lead to improved performance. See this FAQ for more information.