how to clear a cache?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

how to clear a cache?

Herman Bovens
Hi,

When using caches in the MyBatis configuration files, is it possible to clear a specific cache?
In iBatis 2 it was possible to clear a cache with a specific id, but now a cache doesn't even have an id anymore.  So can I clear the cache for a certain name space?
The only thing I could find was SqlSession.clearCache() but that is for the local session cache, so not what I was looking for.

Thanks,
Herman



Reply | Threaded
Open this post in threaded view
|

How to get the sql statement content being executed?

fxbird
Mail

Hi all:

   For some reason ,I need to monitor all sql being executed ,but the coming question is how to get every single sql content beging executed?

   Many thanks.

   Kurt

2011.1.5

 

Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

Alexis Pigeon
Hi Kurt,

2011/1/5 fxbird <[hidden email]>

Hi all:

   For some reason ,I need to monitor all sql being executed ,but the coming question is how to get every single sql content beging executed?


Cheers,
alexis
Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

nanlei1987
In reply to this post by fxbird
If you want to log the execution of the sql, so you may introduce the logging api into your project, such as log4j.

As the example, I use log4j and iBatis2 in my project, the configuration is very simple. In the log4j.xml(I use XML configuration file).

<logger name="com.ibatis">
<level value="DEBUG" />
</logger>

<logger name="com.ibatis.common.jdbc.SimpleDataSource">
<level value="DEBUG" />
</logger>

<logger name="com.ibatis.common.jdbc.ScriptRunner">
<level value="DEBUG" />
</logger>

<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate">
<level value="DEBUG" />
</logger>
<logger name="java.sql.Connection">
<level value="DEBUG" />
</logger>
<logger name="java.sql.Statement">
<level value="DEBUG" />
</logger>
<logger name="java.sql.PreparedStatement">
<level value="DEBUG" />
</logger>
<logger name="java.sql.ResultSet">
<level value="DEBUG" />
</logger>

All the DEBUG level's log will be logged in the log file or the console.

Wish to help!
Nan Lei

在 2011年1月5日 下午6:18,fxbird <[hidden email]>写道:

Hi all:

   For some reason ,I need to monitor all sql being executed ,but the coming question is how to get every single sql content beging executed?

   Many thanks.

   Kurt

2011.1.5

 


Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

fxbird
In reply to this post by Alexis Pigeon
Sorry, I didn't make it very clear. What I want is to monitor in program, specifically I need to do some other operation according to the sql being executed, eg: sychronize the data sql to another db when a insert sql is found being executed.

On Wed, Jan 5, 2011 at 6:40 PM, Alexis Pigeon <[hidden email]> wrote:
Hi Kurt,

2011/1/5 fxbird <[hidden email]>

Hi all:

   For some reason ,I need to monitor all sql being executed ,but the coming question is how to get every single sql content beging executed?


Cheers,
alexis

Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

Larry Meadors
Why not wrap the SqlSession interface to add your functionality to the
insert() method?

On Wed, Jan 5, 2011 at 8:58 AM, fx bird <[hidden email]> wrote:

> Sorry, I didn't make it very clear. What I want is to monitor in program,
> specifically I need to do some other operation according to the sql being
> executed, eg: sychronize the data sql to another db when a insert sql is
> found being executed.
>
> On Wed, Jan 5, 2011 at 6:40 PM, Alexis Pigeon <[hidden email]>
> wrote:
>>
>> Hi Kurt,
>>
>> 2011/1/5 fxbird <[hidden email]>
>>>
>>> Hi all:
>>>
>>>    For some reason ,I need to monitor all sql being executed ,but the
>>> coming question is how to get every single sql content beging executed?
>>
>> http://lmgtfy.com/?q=mybatis+enable+logging
>>
>> :)
>>
>> Cheers,
>> alexis
>
>
Reply | Threaded
Open this post in threaded view
|

How to get the sql statement content being executed?

fxbird
In reply to this post by nanlei1987
Mail

Hi all:

   For some reason ,I need to monitor update sql(insert,delete,update) in program, specifically I need to do some other operation according to the sql being executed, eg: sychronize the data to another db when a insert sql is found being executed. Some guy says wrapping a SqlMapSession, but I don't know how to start with it, don't know many details.

   Many thanks.

   Kurt

2011.1.6

Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

Guy Rouillier
You already have one email thread going on this topic on this mailing
list.  Why did you start another?

On 1/5/2011 8:17 PM, fxbird wrote:

> Hi all:
>
>    For some reason ,I need to monitor update sql(insert,delete,update)
> in program, specifically I need to do some other operation according to
> the sql being executed, eg: sychronize the data to another db when a
> insert sql is found being executed. Some guy says wrapping a
> SqlMapSession, but I don't know how to start with it, don't know many
> details.
>
>    Many thanks.
>
>    Kurt
>
> 2011.1.6
>


--
Guy Rouillier
Reply | Threaded
Open this post in threaded view
|

Re: Re: How to get the sql statement content being executed?

fxbird
Mail
Because in the first mail, the question is not very clear. What's wrong with it?
 
Kurt
 
2011-1-6 ----- Original Message -----
Date: 2011-01-06, 09:44:01
Subject: Re: How to get the sql statement content being executed?

You already have one email thread going on this topic on this mailing
list. Why did you start another?

On 1/5/2011 8:17 PM, fxbird wrote:

> Hi all:
>
>    For some reason ,I need to monitor update sql(insert,delete,update)
> in program, specifically I need to do some other operation according to
> the sql being executed, eg: sychronize the data to another db when a
> insert sql is found being executed. Some guy says wrapping a
> SqlMapSession, but I don't know how to start with it, don't know many
> details.
>
>    Many thanks.
>
>    Kurt
>
> 2011.1.6
>


--
Guy Rouillier
Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

Jose María Zaragoza
In reply to this post by fxbird
2011/1/6 fxbird <[hidden email]>:
> I need to do some other operation according to the sql
> being executed, eg: sychronize the data to another db when a insert sql
> is found being executed.


Why don't use triggers or another feature like that in your RDBMS?

Regards
Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

fxbird
Because :
1. Our side isn't allowed to do it.
2.The other db is at the different place, so trigger can't reach that.

On Thu, Jan 6, 2011 at 5:58 PM, Chema <[hidden email]> wrote:
2011/1/6 fxbird <[hidden email]>:
> I need to do some other operation according to the sql
> being executed, eg: sychronize the data to another db when a insert sql
> is found being executed.


Why don't use triggers or another feature like that in your RDBMS?

Regards

Reply | Threaded
Open this post in threaded view
|

Re: How to get the sql statement content being executed?

Jose María Zaragoza
2011/1/6 fx bird <[hidden email]>:
> Because :
> 1. Our side isn't allowed to do it.
> 2.The other db is at the different place, so trigger can't reach that.

In this case, the better is wrapping sqlmap client