I have one question. Can I work with extended events in Java code? Run sessions and analyze results. Is there a specific api or interface to do this?
Asked
Active
Viewed 95 times
0
-
1What does the SQL Server documentation say? – Joe C Dec 01 '18 at 18:45
1 Answers
0
You are using XE trough T-SQL, like running/stopping sessions with ALTER EVENT SESSION:
ALTER EVENT SESSION test_session ON SERVER STATE = start;
And reading the events e.g. from Ring Buffer Target:
SELECT name, target_name, CAST(xet.target_data AS xml)
FROM sys.dm_xe_session_targets AS xet
JOIN sys.dm_xe_sessions AS xe
ON (xe.address = xet.event_session_address)
WHERE xe.name = 'session_name'
The result XML can be processed in the SQL Server, or you can process in in your Java code.
So the specific API you are looking for is Transact-SQL.

Andrey Nikolov
- 12,967
- 3
- 20
- 32