Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the source of created statement

 
tausahmed ahmed
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have resultset developed using statement like,
Resultset rset = stmt.executeQuery("select ....");
Later at some stage I want to know the query using which resultset is developed i.e. I want to know the string which have used as parameter to the executequery() method.
Please give me solution.
 
Paulo Salgado
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know any method in the API that would give you that, but I've done this with PreparedStatemens by inspecting the object after a breakpoint in a debugger. A field with the SQL statement may be implementation-dependent, but you may want to try it. In my case I was using DB2 and it was there.
Paulo.
 
Lu Battist
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest you either keep track of the sql string yourself, or create a wrapper that would store the sql string for you in an object letting you retreive it on demand. There is nothing ready made in the API to do this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic