It's
Here a sample one that takes in the 2 options:
kill sid serial#
Example : kill 1 2
OR
kill USERNAME
Example: kill KLRICE

var DatabaseChangeListener = Java.type("oracle.jdbc.dcn.DatabaseChangeListener"); | |
var Properties = Java.type("java.util.Properties"); | |
var OracleConnection = Java.type("oracle.jdbc.OracleConnection"); | |
var OracleStatement = Java.type("oracle.jdbc.OracleStatement"); | |
var cmd = {}; | |
cmd.onChange = function(e){ | |
// print it out but could go query the change instead | |
ctx.write("\n Data Changed:" + e.toString() + "\n"); | |
out.flush(); | |
} | |
var MyChangeListener = Java.extend(DatabaseChangeListener, { | |
onDatabaseChangeNotification : cmd.onChange | |
}); | |
var prop = new Properties(); | |
prop.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS,"true"); | |
prop.setProperty(OracleConnection.DCN_QUERY_CHANGE_NOTIFICATION,"true"); | |
var dcr = conn.registerDatabaseChangeNotification(prop); | |
var changeListener = new MyChangeListener(); | |
dcr.addListener(changeListener); | |
var stmt = conn.createStatement(); | |
// associate the statement with the registration: | |
stmt.setDatabaseChangeRegistration(dcr); | |
// build up the sql again | |
var sql=""; | |
for(var i=1;i<args.length;i++){ | |
sql = sql + " " + args[i]; | |
} | |
ctx.write(sql + "\n\n"); | |
var rs = stmt.executeQuery(sql); | |
ctx.write("\nRegistered\n") | |
var tableNames = dcr.getTables(); | |
for(var i=0;i<tableNames.length;i++) | |
ctx.write(tableNames[i]+" is part of the registration.\n"); | |
stmt.close(); |