This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Lets say I have an application for school administration.
Lets say it has the following business scenarios:
- Admit Student - Transfer student - Check grades - Maintain syllabus an so on...
Lets look at the following business scenario "Transfer student"
Lets say it accepts 3 parameters student_id, from_school, to_school
In the backend it will execute few SQL statements and do the required business change.
Let's say it run following SQLs:
SQL1 An SQL to update history or audit table,
SQL2 An SQL to add student to "to_school"
SQL3 An SQL to remove from "from_school"
SQL4 An SQL to update syllabus table
and so on...
Now, my question is how can we get the SQLs (SQL1 through SQLn) executed as part of a particular business scenario?
I need the SQLs for performance testing of my app.
I'd say Database Replay seems fit your needs well. It looks quite complicated however (I've just googled it up and never actually heard of it much before). Similar tool is the Log Miner, though again, I've no experiences with it.
You might also use SQL Trace facility, that will produce trace logs, from whose individual SQL commands could be recovered. You'll have hard time putting in bind values, though.
I've implemented a special PreparedStatement/CallableStatement wrappers in my project, inspired by the DebuggableStatement. I've modified it to save the executed statements to a SQL script file instead of log. If you've got a centralized factory for creating statements in your code, setting it up is easy. I've spend only some three hours or so getting my version of DebuggableStatement to work, and took a few shortcuts in formatting the bind variables (such as no support for blobs/clobs and few others).