There are some good JDBC extension libraries that exist and can make debugging easier, like the P6spy.
This is a library that enables database data to be seamlessly intercepted and logged with no code changes to the application. You can use these to log SQL queries and their timings.
For example, if you are using PreparedStatment and CallableStatement in your code, these libraries can log an exact call with parameters and how much time it took to execute.
If you want to learn more about JDBC, you can check out the Complete JDBC Programming Part-1 course on Udemy.