-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: can show_sql show the bind variable values for preparedstmt?
PostPosted: Wed Sep 07, 2005 10:48 am 
Beginner
Beginner

Joined: Wed Mar 16, 2005 4:07 pm
Posts: 22
hi there,

if i turn on show_sql, the preparedstatements are dumped with "?" in place for each variable? is there a simple way to change it to variable values at run time? i can provide my own jdbc connection and add logging to it. just curious if it's already there somehow.

many thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 11:05 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
are you querying in hibernate because everything I've ever used in hibernate dumps the bind variables to the statement just after the statement line in the log file. It shows ? when the query is discovered by hibernate in the logs, but when it is used I always find bind parameters shortly after it.

like...
Code:
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.SQL  - select jobqueueli0_.instidq as instidq, jobqueueli0_.instid as instid, jobqueueli0_.instcd as instcd, jobqueueli0_.jobid as jobid, jobqueueli0_.userid as userid, jobqueueli0_.status as status3_, jobqueueli0_.priority as priority3_, jobqueueli0_.startdate as startdate3_, jobqueueli0_.starttime as starttime3_, jobqueueli0_.external_eval as external10_3_, jobqueueli0_.read_sysin as read11_3_, jobqueueli0_.servername as servername3_, jobqueueli0_.last_mod_user as last13_3_, jobqueueli0_.last_mod_date as last14_3_ from job_queue_list jobqueueli0_ where jobqueueli0_.status=? and jobqueueli0_.servername=? and (jobqueueli0_.startdate<=? or jobqueueli0_.startdate is null) and (jobqueueli0_.starttime<=? or jobqueueli0_.starttime is null) order by jobqueueli0_.priority, jobqueueli0_.jobid
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.jdbc.AbstractBatcher  - preparing statement
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 2005/02/11 -> startdate [3]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding '2005/02/11' to parameter: 3
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() dars1      -> servername [2]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding 'dars1     ' to parameter: 2
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 14:28 -> starttime [4]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding '14:28' to parameter: 4
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() D -> status [1]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding 'D' to parameter: 1
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.jdbc.AbstractBatcher  - about to open ResultSet (open ResultSets: 0, globally: 0)
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.Loader  - processing result set


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 1:18 pm 
Beginner
Beginner

Joined: Wed Mar 16, 2005 4:07 pm
Posts: 22
well, i am trying a save operation. there is no binding variable printed out.

besides, i would like to have the parameter value embedded in the sql so that you can copy paste the log entry and run it in sqlplus. there is a jdbcconnection wrapper on the internet that can do it. but i hope out of box we can configure hibernate to do it?


kochcp wrote:
are you querying in hibernate because everything I've ever used in hibernate dumps the bind variables to the statement just after the statement line in the log file. It shows ? when the query is discovered by hibernate in the logs, but when it is used I always find bind parameters shortly after it.

like...
Code:
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.SQL  - select jobqueueli0_.instidq as instidq, jobqueueli0_.instid as instid, jobqueueli0_.instcd as instcd, jobqueueli0_.jobid as jobid, jobqueueli0_.userid as userid, jobqueueli0_.status as status3_, jobqueueli0_.priority as priority3_, jobqueueli0_.startdate as startdate3_, jobqueueli0_.starttime as starttime3_, jobqueueli0_.external_eval as external10_3_, jobqueueli0_.read_sysin as read11_3_, jobqueueli0_.servername as servername3_, jobqueueli0_.last_mod_user as last13_3_, jobqueueli0_.last_mod_date as last14_3_ from job_queue_list jobqueueli0_ where jobqueueli0_.status=? and jobqueueli0_.servername=? and (jobqueueli0_.startdate<=? or jobqueueli0_.startdate is null) and (jobqueueli0_.starttime<=? or jobqueueli0_.starttime is null) order by jobqueueli0_.priority, jobqueueli0_.jobid
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.jdbc.AbstractBatcher  - preparing statement
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 2005/02/11 -> startdate [3]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding '2005/02/11' to parameter: 3
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() dars1      -> servername [2]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding 'dars1     ' to parameter: 2
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() 14:28 -> starttime [4]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding '14:28' to parameter: 4
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.hql.QueryLoader  - bindNamedParameters() D -> status [1]
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.type.StringType  - binding 'D' to parameter: 1
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.jdbc.AbstractBatcher  - about to open ResultSet (open ResultSets: 0, globally: 0)
06 Sep 2005 10:48:49 : [DEBUG] org.hibernate.loader.Loader  - processing result set


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.