%META:TOPICPARENT{name="LicenseTerminology"}%
---++ How Do I Monitor Open Database Sessions Associated With DB2 ODBC Connections
You can use the Event Monitors feature that is present in the DB2 System Monitor. The Event Monitors feature allows you to create and activate a monitor that logs for one or more of each of the following events:
* Deadlocks
* Statements
* Transactions
* Connections
* Database
* Buffer pools
* Table spaces
* Tables Read or Written
These monitors may be created and activated using the following syntax:
db2 connect to
db2 "create event monitor for write to file 'filename'"
mkdir
db2 "set event monitor state 1"
For example
*Unix*
db2 connect to sample
db2 "create event monitor connmon for connections write to file '/tmp/connections/connmon.log'"
mkdir /tmp/connections
db2 "set event monitor connmon state 1"
*Windows*
db2 connect to sample
db2 "create event monitor connmon for connections write to file 'C:\Temp\connections\connmon.log'"
mkdir C:\Temp\connections
db2 "set event monitor connmon state 1"
Use db2evmon -path to format and display the contents of the log. For example:
*Unix*
db2evmon -path /tmp/connections/connmon.log
*Windows*
db2evmon -path C:\Temp\connections\connmon.log
Finally, deactivate event monitors by setting the state to 0. For example:
db2 connect to sample
db2 "set event monitor connmon state 0"