Is there any way we can see the currently executing queries initiated from a java dynamic web application ? Is it possible to do so by interfacing with the JDBC Driver ?
Asked
Active
Viewed 54 times
-1
-
What would you use it for? – Kayaman Jun 16 '16 at 09:30
-
To identify the web app from which a particular query is executed – JimmyJ Jun 17 '16 at 07:37
1 Answers
1
P6Spy can be used for that.
P6Spy functions like proxy, intercepting and logging JDBC calls and forwarding them to the real driver afterwards. In the application is the JDBC connection configured to go to the P6Spy driver and then inside the P6Spy configuration is the real connection configured to which P6Spy forwards.
There is also number of alternatives.
-
If there are multiple web apps using the JDBC connection can we isolate the application from which the query is fired ? – JimmyJ Jun 17 '16 at 07:42
-
-
They use the same JDBC driver right ? So from this common point , cant we isolate the suspect ? – JimmyJ Jun 17 '16 at 09:18
-
The fact that multiple application use the same JDBC driver does not make them to share the same connection. But of course you might configure P6Spy for all applications and then search in multiple logs. But if you are just trying to identify which application issued one given statement that you see on the RDBMS side, then you might as well try some different strategy, like giving each application unique DB user (usually on the RDBMS side you see statement and which user executed it). – Michal Jun 17 '16 at 14:03
-
But if that is your goal I would suggest you ask a new question. How to identify which application issued which statement is not the question you asked and I answered here. – Michal Jun 17 '16 at 14:06