Listing 1

MyTracerBean myTracer = new MyTracerBean();
//In this case we want the 100 most recently executed statements
JDBCStatementProfile[] profiles = myTracer.getProfiles(100);
//Doing the looping so that the most recent statements information is
//retrieved first
for (int i=profiles.length-1;i>-1;i--) {
//Getting the number of parameters passed into the current //statement
int paramCount = profiles[i].getParameterCount();
	//Format the start and end time for the current statement
	SimpleDateFormat simpleDateFormat =
	new SimpleDateFormat("yyyyy.MMMMM.dd GGG hh:mm:ss:SS aaa");
String startTime=simpleDateFormat.format(new Date(profiles[i].getStartTime()));
String endTime=simpleDateFormat.format(new Date(profiles[i].getStopTime()));

//Append the parameters together in order to display them
StringBuffer paramsBuffer = new StringBuffer();
	if (paramCount < 1) {
		paramsBuffer.append("None");
	} else {
for (int j=0;j<paramCount;j++) {
			paramsBuffer.append(profiles[i].getParameter(j));
			paramsBuffer.append(" ");
			}
	}

	String statementTxt = profiles[i].getStatementText();
String paramsTxt = paramsBuffer.toString();
String timeTaken = profiles[i].getTimeTaken()

//Then use statementTxt, paramsTxt, timeTaken, startTime, endTime
// etc to show the statement details in a UI
}