Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to print all SQL statements performed by JDBC?

Without changing anything in my code is there a way to tell JDBC to print any query executed by Statement#executeUpdate(...) and Statement#execute(...)?

It would be really useful for debugging purposes.

like image 310
Luka Avatar asked Dec 01 '25 10:12

Luka


1 Answers

Yes. Use a wrapper around the actual driver like P6Spy. There are probably other tools in the same league.

EDIT: P6Spy seems to be dead. But I also found JDBCGrabber.

like image 174
JB Nizet Avatar answered Dec 02 '25 22:12

JB Nizet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!