ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lucy Fang <f...@acs.rutgers.edu>
Subject RE: Are there any ways to view the SQL mapping statements?
Date Wed, 05 Jan 2005 17:15:01 GMT
Hi Brandon,

I have set up my log4j.properties for iBatis (it works with other part of my
application) by following the user guide, but I still can't get the sql
statement log. I don't know how I can get a special sql statement pass to
the log in the java code. For example I want to view the sql statement for
"selectOrganizationById".

Thanks.

Lucy

Here is my Log4j.properties
===========================
log4j.rootLogger=DEBUG, stdout

# SqlMap logging configuration... 
#log4j.logger.com.ibatis=DEBUG 
#log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG 
#log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG 
#log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
#log4j.logger.java.sql.Connection=DEBUG 
#log4j.logger.java.sql.Statement=DEBUG 
log4j.logger.java.sql.PreparedStatement=DEBUG 
#log4j.logger.java.sql.ResultSet=DEBUG 

# Console output... 
log4j.appender.stdout=org.apache.log4j.ConsoleAppender 
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n



-----Original Message-----
From: Brandon Goodin [mailto:brandon.goodin@gmail.com] 
Sent: Thursday, December 16, 2004 3:58 PM
To: fang@acs.rutgers.edu
Cc: ibatis-user-java@incubator.apache.org
Subject: Re: Are there any ways to view the SQL mapping statements?


You could use logging to view your sql statement and the parameters it is
receiving. But, there is no simple way to view the sql statement combined
with your parameters. IBatis uses PreparedStatement underneath and there is
no way to view the compiled sql statement in java. There is a section in the
User Guide that explains how to log your SQL


On Thu, 16 Dec 2004 14:25:08 -0500, Lucy Fang <fang@acs.rutgers.edu> wrote:
> 
> 
> Hi,
> 
> Are there any ways I can view the SQL mapping statements after created 
> a dynamic SQL statement and passed all of parameters to it?
> 
> I have a dynamic SQL mapping statement with 
>         select * from campus where campuscode in #campusCode#
> if I use campuscode in (03,04), it works good. But if I use the parameter
> campusCode replace the value, it doesn't work. I pretty sure the parameter
> value is "(03,04)".
> 
> The database I am using is Oracle and iBatis is SQL Map 2.0.
> 
> Thanks.
> 
> Lucy


Mime
View raw message