Guest User

Untitled

a guest
Jan 9th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. create or replace and compile java source named windowserrors as
  2. public class OpenWindows
  3. {
  4. public static void ErrorText()
  5. {
  6. try
  7. {
  8. Process proc = Runtime.getRuntime().exec("Msg * ошибка");
  9. while (true)
  10. {
  11. try
  12. {
  13. proc.waitFor();
  14. break;
  15. }
  16. catch (Exception t)
  17. {
  18. t.getMessage();
  19. }
  20. }
  21. }
  22. catch(Exception e)
  23. {
  24. e.getMessage();
  25. }
  26. }
  27. }
  28.  
  29. PROCEDURE Rise_error AS LANGUAGE JAVA
  30. NAME 'OpenWindows.ErrorText()';
  31.  
  32. BEGIN
  33. p_oms_patreg.Rise_error;
  34. END;
  35.  
  36. create or replace and compile java source named windowserrors as
  37. public class OpenWindows {
  38. public static void ErrorText() throws Exception {
  39. Process proc = Runtime.getRuntime().exec("Msg * ошибка");
  40. proc.waitFor();
  41. }
  42. }
  43.  
  44. CREATE OR REPLACE PROCEDURE Rise_error AS LANGUAGE JAVA
  45. NAME 'OpenWindows.ErrorText()';
  46.  
  47. begin
  48. rise_error();
  49. end;
  50.  
  51. create or replace and compile java source named Host as
  52. public class Notifier
  53. {
  54. public static void notifyUsers (String message) {
  55. try {
  56. Process proc = new ProcessBuilder ("MSG", "*", message).start ();
  57. proc.waitFor();
  58. System.out.println ("The Users were notified via message=" + message);
  59. }
  60. catch (Exception e) {
  61. System.out.println ("Exception: " + e.getMessage ()); // or e.printStackTrace
  62. }
  63. }
  64. };
  65. /
  66. Java source HOST compiled
  67.  
  68. create or replace procedure notifyUsers (message varchar2) as
  69. language java name 'Notifier.notifyUsers (java.lang.String)';
  70. /
  71. Procedure NOTIFYUSERS compiled
  72.  
  73. set serveroutput on size unlimited
  74. exec dbms_java.set_output(10000)
  75.  
  76. exec notifyUsers ('Unknown Error occurred')
  77.  
  78. PL/SQL procedure successfully completed.
  79.  
  80. Exception: the Permission (java.io.FilePermission <<ALL FILES>> execute)
  81. has not been granted to SH. The PL/SQL to grant this is
  82. dbms_java.grant_permission( 'SH', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' )
  83.  
  84. begin
  85. dbms_java.grant_permission('SH', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute');
  86. dbms_java.grant_permission('SH', 'SYS:java.lang.RuntimePermission','writeFileDescriptor','*');
  87. dbms_java.grant_permission('SH', 'SYS:java.lang.RuntimePermission','readFileDescriptor','*');
  88. end;
  89. /
  90.  
  91. set serveroutput on size unlimited
  92. exec dbms_java.set_output(10000)
  93.  
  94. exec notifyUsers ('Unknown Error occurred')
  95.  
  96. PL/SQL procedure successfully completed.
  97.  
  98. The Users were notified via message=Unknown Error occurred
Add Comment
Please, Sign In to add comment