0

I'm working on a feature for a program and want to see the recently used commands that the program (using java/hibernate) or in general anyone connecting to the DB has used.

What is the best way to go around this to see the db2 history. I can not figure it out for the life of me.

Thank you.

2 Answers2

0

One way to do that is to create DB2 connectors that wraps all connections.

For example, a JDBC connector, that captures the statement, and then send it to DB2. You will need to receive all possible parameters, and send that to DB2. In the other way, you need to get all from the IBM driver and send back to the user.

A similar thing for ODBC and other connectors.

Finally, for command line, you can create something similar to rlwrap, where you can capture the query and send it to db2clp.

However, this solution is local for each connection, then, you need a method centralize all statements.

AngocA
  • 7,655
  • 6
  • 39
  • 55
-1

¿Where do you have the commands logs ? ¿ log tables/log files?

Basic tutorial for select records from a table with JDBC:

https://www.tutorialspoint.com/jdbc/jdbc-select-records.htm1

For read files:

Reading a plain text file in Java

Hope it help you, Or give you a better idea of ​​what you need

Community
  • 1
  • 1
Matías W.
  • 350
  • 2
  • 17
  • I just want to see which programs executed what commands on the database. It seems that one of the programs did a massive deletion on the database, and I want to figure out what commands they ran against it through some search/history command/tool – Sarkis Jan 03 '17 at 19:35