473,396 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

want to run an exe from oracle trigger

Hello,

I have written a java stored procedure to execute an exe file, which works fine when compiled.The class code is given below.

create or replace and resolve java source named "CommandExection"
as
import java.io.*;
import java.util.*;

public class CommandExection1 {

public static void Command(String commandline) {

try {

String line;

Process p = Runtime.getRuntime().exec(commandline);

BufferedReader input =

new BufferedReader

(new InputStreamReader(p.getInputStream()));

while ((line = input.readLine()) != null) {

System.out.println(line);

}

input.close();

}

catch (Exception err) {

err.printStackTrace();

}

}
}
/

Through a stored procedure i am acessing the class which is given below,

create or replace procedure Exe_cmd(path in varchar2)
as
language java
name 'CommandExection1.Command(path)';

I am able to create stored procedure sucessfully.And i have set permissions to execute procedure as shown below

SQL> declare
2 SCHEMA varchar2(30) := 'SYSTEM';
3 begin
4 dbms_java.grant_permission(
5 SCHEMA,
6 'SYS:java.io.FilePermission',
7 '<<ALL FILES>>',
8 'execute'
9 );
10
11 dbms_java.grant_permission(
12 SCHEMA,
13 'SYS:java.lang.RuntimePermission',
14 'writeFileDescriptor',
15 '*'
16 );
17
18 dbms_java.grant_permission(
19 SCHEMA,
20 'SYS:java.lang.RuntimePermission',
21 'readFileDescriptor',
22 '*'
23 );
24
25 commit;
26 end;
27 /

PL/SQL procedure successfully completed.
I am able to execute it but not able to see my output its just showing as below


SQL> exec Exe_cmd('D:\\exeapp.exe');

PL/SQL procedure successfully completed.

if i use

set serverout on size 1000000

exec dbms_java.set_output(1000000)
then execute my procedure i amgetting the following
SQL> exec Exe_cmd('D:/exeapp.exe');
java.io.IOException: The handle is invalid.
at oracle.aurora.java.lang.OracleProcess.create(Nativ e Method)
at oracle.aurora.java.lang.OracleProcess.construct(Or acleProcess.java:25)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:566)
at java.lang.Runtime.exec(Runtime.java:428)
at java.lang.Runtime.exec(Runtime.java:364)
at java.lang.Runtime.exec(Runtime.java:326)
at Trial.Try(Trial:12)

PL/SQL procedure successfully completed.


I couldnt find the output of my exe file which opens up a ASP.net Window Form.
From three days I am trying so many things to achieve this but i am not able to do.
Please help me.
Aug 7 '07 #1
1 5244
RedSon
5,000 Expert 4TB
Moved from misc. This maybe better suited to an SQL forum.
Aug 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Hindmoor | last post by:
Hi, I am sure if anyone can help me, you guys can! I am an Informix Developer, moving to Oracle 8i and later databases. I am struggling to find the Oracle equivelant to many of the useful...
4
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON...
1
by: Ken | last post by:
Need help on the Auto Number or Identity Seed on the Oracle Database I got an Access database that need to be converted to Oracle 9i. Somehow the Trigger we created to simulate the "AUTO NUMBER"...
3
by: db2sysc | last post by:
1. In the oracle trigger we have a SINGLE INSERT STORED PROCEDURE CALLED MUTLIPLE TIMES with different values. But when changed to DB2, it gives SQL -746 ?? Any help?? 2. In oracle we have ...
4
by: dhcomcast | last post by:
We're starting to use Oracle for the back-end instead of a separate Access .mdb file for the data and everything as gone surprisingly well so far. We are learning Oracle as we go; Yikes! But we...
7
by: peter.morin | last post by:
Issue: I am inserting an Oracle record containing insert trigger via Access 2002 using the code below. The issue is that the sequence from the acSaveRecord is not reflected after the insert so...
0
by: Yogesh | last post by:
Hello Everyone I have to create Oracle tables in my application on the fly, which have an Autonumber field. So, everytime I create a table, I have to create a corresponding sequence and trigger...
0
by: gshawn3 | last post by:
Hi, I am having a hard time creating a Trigger to update an Oracle database. I am using a SQL Server 2005 Express database on a Win XP Pro SP2 desktop, linked to an Oracle 10g database on a...
5
by: jith87 | last post by:
hi all, i need to call a proceedure for sending email by setting up a "INSERT AFTER" trigger for a table.i need to pass the mail id as a parameter to the procedure for sending email. that...
2
by: singhjih | last post by:
The table looks like the following: Code ------------------- INSTRUCTOR_ID(PK) NUMBER(8,0) NOT NULL SALUTATION VARCHAR2(5) NULL FIRST_NAME VARCHAR2(25) NULL LAST_NAME ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.