4 Replies Latest reply on Oct 11, 2012 4:46 AM by Prabhu Natarajan

    Logging PreparedStatement details

    Prabhu Natarajan Newbie



      Our application uses MySQL with JBoss EAP 6.0.

      We used to print the PreparedStatement query details in the log using the below approach


      logger.debug( " Query details " + preparedStatement.toString() ); -- [after it is set with all parameters]


      However after implementing connection pooling in JBoss we are getting a Wrapper statement

      and it just prints a object instance detail instead of query details like below



      Standalone configuration for Datasource is


      <datasource jta="false" jndi-name="java:jboss/datasources/testDS" pool-name="TestDataSource" enabled="true" use-ccm="false" >






      The WrappedPreparedStatement has a getUnderlyingStatement() function to get the PreparedStatement, however for that

      we need to use JBoss specific Wrapper Classes, which will couple our application to a specific server implementation.


      What is the other way we get print the details of the PreparedStatemnt after it is set with all the parameters?