Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prepared Statement - printing out the statement

 
Baba Bizlowsky
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you "print out" on the screen the contents of the Prepared Statement?

Thanks in advance. Cheers!
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Baba Bizlowsky wrote:
I can't understand what is wrong in here...

I have a simple table: PERSON [ID (integer), NAME (string), SURNAME (string)]



result of that is:




What comma? I KNOW this is something trivial and I'm probably missing it due to it being 3am, but it is driving me nuts.. help, please?

You should be using PreparedStatement#executeUpdate() for INSERT/UPDATE/DELETE queries.


How do you "print out" on the screen the contents of the Prepared Statement?

Thanks in advance. Cheers!

Wrap PreparedStatement with an own implementation which decorates the original PreparedStatement and let the setter methods write to some buffer. There are libraries out for this such as p6spy.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recall reading that JAMON does that.
 
Baba Bizlowsky
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

Especially on the answer of the original question which I edited out because I didn't think anyone would bother analyzing actual code.

I''l check out this Jamon.

Cheers!
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don´t see how printing the statement would help the original problem.

Just post the actual problem. If printing the statement might solve the problem, we´d mentioned it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic