Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Intercepting sql calls in tomcat

Hi Frank,
 
It probably depends on the type of pointcut you intend to use and where the calls to PreparedStatement.executeXXX() lie in terms of bytecode. According to the AspectJ documentation, the AspectJ compiler must control the bytecode for the caller using call() type pointcuts. The AspectJ compiler must control the bytecode of the method or constructor body in question when using an execution() type pointcut.
 
So, if you wish to use execution() type of pointcuts, the AspectJ compiler needs to weave into the JDBC driver .jar file you are using. In that case you would need to put the original JDBC driver as an inpath argument and direct the output to a modified version of the JDBC driver .jar file. Then at runtime, you need to include the modified version of the JDBC driver .jar file on the classpath to be working with the woven version.
 
If you wish to use call() type of pointcuts, the question then is where does the bytecode lie that has calls to PreparedStatement.executeXXX(). If it is in third party jar file, you need to weave into that third party jar file in a similar fashion as I described in the previous paragraph. If it is your code that is being compiled, the compilation step of your code via the AspectJ compiler should do the trick.
 
Hope that helps.
 
Thanks,
 
Doug
 
-------------- Original message --------------
From: "Luo, Frank" <Frank.Luo@xxxxxxxxxxxxxxx>

I am wondering if any one has an example on intercepting sql calls such as PreparedStatement.executeXXX() in Tomcat environment.

It sounds pretty basic, but I just couldn't see any java.sql.. calls being intercepted.

Thx!


Back to the top