I am using the sp_trace_create to just test this functionality in Junit. This is executing successfully. To be able to run this multiple times, I need to delete the trace file which is created.
cursor.parseCall("DECLARE @traceid int;" +
"EXECUTE @traceid=sp_trace_create ?,?,?,?,? ;" +
"SELECT @traceid");
cursor.registerOutParameter(1, DBType.SQLT_INT);
cursor.setIntParam(2, 2);
cursor.setStringParam(3, "C://trace23");
cursor.setLongParam(4, 4);
cursor.setDateParam(5, stopDate);
cursor.executeCall();
I want to know how to delete the file which is created ( in remote) in the location C://trace23.trc.
Another option is to sort of timestamp the file name with the date
cursor.setStringParam(3, "C://trace"+cal.getTimeInMillis());
But I am not sure how correct this is.