• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC logging?

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using PreparedStatements to build my query, and bind the parameters.

What i would like to do is to see the final queries that are sent to the database. (For debug purpose)

What is the preffered way to do this? Should i configure a logger for JDBC?

Thanks

 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this: http://www.rgagnon.com/javadetails/java-0411.html

For more options (for more effort): http://code.google.com/p/log4jdbc/
 
Gabriel Beres
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:Try this: http://www.rgagnon.com/javadetails/java-0411.html

For more options (for more effort): http://code.google.com/p/log4jdbc/



Unfortunatelly i get my connection through UCP, so the approach in the first link does not work.
Are there any simpler way than the second link?
 
Gabriel Beres
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gabriel Beres wrote:

Tim Moores wrote:Try this: http://www.rgagnon.com/javadetails/java-0411.html

For more options (for more effort): http://code.google.com/p/log4jdbc/



Unfortunatelly i get my connection through UCP, so the approach in the first link does not work.
Are there any simpler way than the second link?




Is it possible to see the queries right in the database? i'm using oracle.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some databases have tools to do the logging on the database side. In Oracle for example, it is the SQL trace facility. Depending on how it is activated, it can record full SQL of the executed queries, values of bind variables and execution plans used. Other databases might offer similar tools.
 
Gabriel Beres
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martin Vajsar wrote:Some databases have tools to do the logging on the database side. In Oracle for example, it is the SQL trace facility. Depending on how it is activated, it can record full SQL of the executed queries, values of bind variables and execution plans used. Other databases might offer similar tools.



Thanks i'll try that.
 
reply
    Bookmark Topic Watch Topic
  • New Topic