[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Pointcut to capture prepared statement variables
|
Hi Alexander ,
I do want to capture the sql text and
their bind variables when any prepared statement goes for database execution
, currently doing Loadweaving with aspectj.
The aspectj advice i am using is
ResultSet around():
((call(*
java.sql.Statement.execute*(..))||(call(*
java.sql.PreparedStatement.execute*(..))))&&(!call(*
java.sql.Statement.close()))){
starttime=System.currentTimeMillis();
ResultSet rs = proceed();
endtime=System.currentTimeMillis();
system.out.println("Time
taken for JDBC call in miilis .."+(endtime-starttime));
return
rs;
}
Sample Java program:
Connection con =getConnection();
PreparedStatement ps = con.prepareStatement("SELECT
* FROM employee where emp_id=?");
ps.setInt(1,2);
ResultSet res = ps.executeQuery();
Is there a way to extract the sql query
and respective bind values for that query.
Thanks,
Krishna=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you