This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Do you really want to look at the protocol between the JDBC driver and the server, or do really want to know what queries are being sent? To log the queries, log4j has a logging facility, which has some limitations. Various people have tried to fix these, e.g. see here and here ... a google search for 'jdbc log4j' might find even more. There's also this article from IBM developer works. If you're using some O/R mapping tool, or an app server, it may have facilities for doing the logging. Also, your database server can probably be set-up to log queries. As for lower-level protocol logging, most JDBC drivers interact with the server in the same way as any other client. The tools to look at the interaction are specific to the DBMS.