How to track database transaction?

I wrote a web application for payroll system that can (insert, update, delete) into mysql database.

I want to know

how many transactions occurred in the mysql database?
how many transactions occurred in the mysql database during start_time and end_time?

+8
java sql mysql transactions
source share
2 answers

MySQL has instruction counters. They can be seen with the SHOW GLOBAL STATUS LIKE "COM\_%" . Each execution of the command increments the counter associated with it. Transaction-related accounts, Com_begin , Com_commit and Com_rollback . Uptime is also the number of seconds since the server started. Reading and graphically displaying these values ​​or their delta gives the information you request.

There are also counters for Com_insert , Com_update , Com_delete and their variations. You might also want to draw them.

+4
source share

Not sure what you are looking for is the answer. I heard that the following JDBC logger is very useful for tracking what the application is doing with the database. It should show where your application opens and makes transactions. You can then write several scripts to process the logs to determine the number of transactions.

http://code.google.com/p/log4jdbc/

It is mainly located between your application and the actual database driver. You add the log4jdbc prefix to the JDBC URL. For example, if your regular jdbc url

 jdbc:mysql://db.foo.com/webapplicationdb 

then you change it to:

 jdbc:log4jdbc:mysql://db.foo.com/webapplicationdb 
+2
source share

All Articles