MaintainJ currently does not support Microsoft SQL Server out-of-the-box.
This is because MaintainJ needs to instrument the JDBC driver classes to capture the runtime SQL statements and Microsoft disallows instrumenting their JDBC driver. Below are the two steps required to trace the applications using MS SQL Server.
1. To avoid the problems with instrumentation, I unjar’ed the Microsoft JDBC driver jar file, removed the signing logic under the META-INF folder and jar’ed up the files again. You can download the changed jar from here. Please replace the original sqljdbc4.jar file with the downloaded jar file while tracing the application with MaintainJ. You may notice that there are no changes at all to the class files in the new jar.
2. Next, you need to change the aop.xml file. Below is a sample aop.xml (for a J2SE app) to use while tracing MS SQL Server applications. The relevant parts are highlighted. The default generated aop.xml needs to be edited and this FAQ explains the location of aop.xml and how to edit it.
<concrete-aspect name=”com.maintainj.inst.J2SEAspect” extends=”com.maintainj.aspect.J2SEExecutionDataAspect”>
<pointcut name=”anyExecution” expression=”execution(public * *.*(..)) || execution(public *.new(..))”/>
<pointcut name=”beforeMain” expression=”execution(public static void com.db.test.TestDBManager.main(String))”/>
<pointcut name=”excludedPointcut” expression=”execution(* com.microsoft.sqlserver.jdbc..*.*(..)) || execution(com.microsoft.sqlserver.jdbc..*.new(..))”/>
<weaver options=”-proceedOnError -nowarn -XaddSerialVersionUID -showWeaveInfo -verbose”>
If you are using jTDS Driver: If you happen to be using jTDS driver to access the MS SQL Server, simply replace com.microsoft.sqlserver.jdbc with net.sourceforge.jtds.jdbc everywhere in the above aop.xml.
If this feels like lot of changes, contact us and we would be happy to help.