1

I'm running into an issue with a query my Java app is executing against an Oracle DB. Taking the query from exception and replacing the parameters (denoted as ? in the exception log) has it running fine in the DBA tool.

So I want to get a good look at the parameters being set in the final query that's actually being passed to Oracle, and I can't find a clear way to grab that from the @Select annotation.

I've been curious on doing that for a while, so this question is specifically about if it's possible to grab that parameterized query being sent to Oracle, not the specific query or error I'm getting. Appreciate the help.

Poken1151
  • 570
  • 5
  • 20
  • Did you check [Mybatis logging](https://stackoverflow.com/questions/33749846/mybatis-log4j-how-to-confiure-log4j-to-print-sql-log-to-file?answertab=active#tab-top)? – Marmite Bomber Jul 16 '18 at 19:26
  • Additionally make sure that in the adHoc query you use the same connection user and setting as configured for MyBatis. – Marmite Bomber Jul 17 '18 at 18:41

1 Answers1

0

This is described in documentation

In a nutshell:

  1. configure the logging provider you use in mybatis-config.xml
  2. depending on the provider set TRACE logging level for the mapper you are interested in

For logback provider this is described for example here. For log4j mybatis documentation has more than enough information.