• 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

My new favourite thing: DebuggableStatement

 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use PreparedStatements a lot, but the biggest thing that annoys me about them is that you can't print them out after you have set the values. A PreparedSatement has no meaningful 'toString' implementation.
Until this.
This article from JavaWorld provides a simple way to add a wrapper to a PreparedStatement so that you can print the equivalent SQL and see what the current state is.
I'm still playing with it, but it's much better than not having any way of seeing inside a PreparedStatement.
Dave
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What, haven't you heard about P6Spy?
http://www.p6spy.com/
[Or is that not suitable for you?]
Cheers,
Avi.
 
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I prefer the solution that just means changing the driver name to enable statement/timing logging rather than rewritting code. (i.e. P6spy)
That said, you might as well just use the oracle tracing utilities.
Simon
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We plugged the DebuggableStatement into our persistence framework so its use is defined by the debugging property. ie when we are in debug mode, it also uses the DebuggableStatement to log statements, otherwise it uses PreparedStateents directly.
I'm still not convinced the DebuggableStatement behaves exactly the same as a PreparedStatment, so I'm being wary, but it has definitely made the last two days easier for me.
 
I think I'll just lie down here for a second. And ponder this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic