How can I get the exit code of a script .bat for Java back to PL/SQL?

When you call a .bat script, only the exit code 1 returns. How can I get 7 back to the PL/SQL in the code example below?

C:\Users\pwatson\src\java > type vv.sql

set echo on

-call dbms_java.grant_permission ('SYSTEM', 'SYS:java.io.FilePermission', '< < all FILES > >', 'run');

HOME @EXIT/b ECHO 7 > vv.bat

TYPE of HOST vv.bat

CREATE OR REPLACE AND COMPILE THE SOURCES NAMED AS VV JAVA

import of java.lang.Runtime;

public class VV

{

public static int execute()

survey java.io.IOException, java.lang.InterruptedException

{

int exitCode = 0;

Duration rt = java.lang.Runtime.getRuntime ();

Process proc = rt.exec ("cmd.exe /C v.bat 1 > NULL 2 > ZERO");

proc.waitFor ();

exitCode = proc.exitValue ();

return exitCode;

}

}

/

CREATE OR REPLACE FUNCTION JavaRunShellCommand

RETURN NUMBER

IN THE JAVA LANGUAGE

NAME 'VV.execute () return oracle.sql.NUMBER;

/

DISPLAY ERRORS

NUMBER VARIABLE n;

CALL JavaRunShellCommand() IN: n;

PRINT n

DISPLAY ERRORS

SELECT JavaRunShellCommand() AS R FROM DUAL;

DISPLAY ERRORS

HOST DEL v.bat

OUTPUT

It is strange that there are no errors. If the Java code does not work, I would expect an exception. Without an exception in the code handler, I expect to be propagated all the way to the top of the call stack and be displayed by the client. But there is no exception.

So that means, in my view, that there is nothing wrong with the code Java itself. He made the appeal successfully to run this external process. The fact that the external process falls down, is not an issue/error in Java.

If this is the case, then the first thing that comes to mind, is that the Oracle (oracle.exe) process that is currently running, runs as a service of the o/s. And that the service will try to run a command through the command shell script. There may be a security or problem access here that prevents the oracle.exe running as a service to do this.

Tags: Database

Similar Questions

  • How can I get the color codes for the notebook

    How can I get the color codes for the notebook?

    Hello

    What is the color codes for the notebook?

    Perhaps you need a 3rd party utility like GetDiz - Free and others to be
    found using BING or Google.

    GetDiz Notepad - free - replacement
    http://www.Outertech.com/en/Notepad-replacement

    I hope this helps.

  • How can I get the activation code for PC Defender?

    I have a dell netbook.  It has viruses on it.  PC Defender is constantly on it saying that if I put in the activation code sent to my e-mail address, it will remove the virus.  The code was never sent.  I can't access it from my netbook, but I can check my email from my other laptop.  How can I get the activation code so can clean my netbook?

    PC Defender is a rogue security application.  It is also a malware!  You can remove it by following these instructions:
    http://www.bleepingcomputer.com/virus-removal/remove-Windows-PC-Defender
    Trader2100

  • deleted reception for windows buy but not print product code. How can I get the product code of return

    I bought a code produced, printed at the front desk but the product code does not print.  How can I get the product code of return?  I have the order #.

    Please see: key product & downloads

  • I have lost the key code for my Adobe Acrobat Standard for Windows (CD) XI.  I had at my office and need to reinstall.  How can I get the key code?

    I have lost the key code for my Adobe Acrobat Standard for Windows (CD) XI.  I had at my office and need to reinstall.  How can I get the key code?

    There is a number on the CD.  Is it possible to contact Adobe and get the key code for this product?

    Hello

    Please check the help below document:

    Quickly find your serial number

    In the case of the volume license product, please visit: site Web of Adobe License | Serial numbers | Orders | Accounts

    Kind regards

    Sheena

  • When I try to log in to Photoshop it keeps asking me for a 'unlock code' so I can't get into my pictures. How can I get the unlock code

    When I try to log in to Photoshop, it keeps asking me for a 'unlock code' so I'm unable to access my photos how can I get the unlock code

    Thank you for your response to my query. I have the Album Starter Edition 3.2. It's a box of product registration keeps coming back when I try to log in. This starter edition has been downloaded as a trial as I have used for some years now without difficulty until I have to register and pay for the privilege of using it. I tried to register, but registration box disappears. I'm sorry to be vague, but I'm not as into it as you and still trying to familiarize themselves with computer terminology and everything very confusing sometimes. Even the delay in responding to your response to my query is due to not being able to navigate the Web site to know how to respond.

    SORRY, but I hope you can help

  • How can I get the adobe Creative Cloud ENT 1.0 for Windows 10 Installer?

    How can I get the adobe Creative Cloud ENT 1.0 for Windows 10 installation program?, is - if compatible win 10 Pro?

    I don't understand if you're talking about the creative cloud Packer, which is used to create deployment packages or the creative Cloud Desktop Application that is used to install and update applications on office services and access.

    Creating cloud packer is available from the deployment Enterprise Dashboard, site Licensing tab or the creative teams of cloud portal.

    The creative Cloud Desktop Application can be downloaded to desktop applications Adobe Creative Cloud | Adobe Creative Cloud

    Both are compatible with Windows 10.

  • How can I get the redemption code to install creative cloud? I paid for it but nothing

    I can't install Creative Cloud (lightroom, photoshop CC), I paid for it, but noting. I can't get the redemption code, I lost time... Can you explain to me how to do this. I can't send email... Thank you

    Are you unable to install Adobe Creative Cloud application?

    Or are you be prompted to enter the serial number when you launch CC apps?

    "If you need more information on the redemption code, you can check the link below:

    https://helpx.Adobe.com/x-productkb/global/redemption-code-purchase-help.html

    Alternatively, you can contact Adobe Support via Live Chat «:»

    https://helpx.Adobe.com/contact.html?step=CCSN_membership-account-payment_account-settings _stillNeedHelp

    Click on the button still need help and select the Chat option.

  • How can I get the windows classic color schemes (extra-large) for Server 2003

    Hello

    I have an installation of Windows Server 2003 Ent Terminalserver. Here, I am able to select a colorscheme like classic windows (extra-large).
    On an other W2K3 Terminalserver, I am not able to select. Only normal color schemes are possible.
    How can I get these additional color schemes.

    Thanks for the replies.

    Concerning
    Marc

    Hi Knima,

    Thanks for posting on the Microsoft Community Forums!

    I suggest you to send your request in the TechNet Forums for assistance.

    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer

    It will be useful.

    Let us know if you encounter problems under windows in the future. We will be happy to help you.

  • How can I get the IMEI code of the device?

    Hello world.

    I have a problem. I need to get the IMEI code of the device. How this could be done?

    System.getProperty ("IMEI") returns null.

    Phone class provides only the possibility to obtain the phone number.

    I use BB JDE 4.6.0 application developed for the peripheral BB 9000.

    Could someone help me?

    Thank you

    Maksym

    GPRSInfo.imeiToString(GPRSInfo.getIMEI(), false);
    

    P.S. This only works on GSM/UMTS phones. It will not work on CDMA phones or iDEN.

  • How can I get the registration code to my KDL-40W600B?

    Just like the title says, I have a new KDL-40W600B and have need the code of registration for some of the apps I would like to use. Instructions for a pop - up on the Web of Sony Essentials page is as follows: to get the Registration Code please make sure that your active internet BRAVIA TV is connected to your network, powered and active. Press the Home button on your remote control and access the network icon in the Xross Media Bar. Scroll to activate enhanced features and select it by pressing on enter. Look for the Registration Code to your BRAVIA TV. Evil.

    Hi jeansebastienhamet!

  • Pavilion a6230n: How can I get the product code (UPC) for an HP computer?

    Hello, I'm selling an old HP desktop that I hang out on Amazon.

    But in order for me to post on Amazon, I need to create a new list, since nobody else is for sale. To create a new list, I need a product code unique for the desktop computer. I'm looking for the Universal Product Code (UPC). A UPC code is the bar code that would be tested at the point of sale when someone buys something.

    I have a few other computers, I'm trying to sell, and on the site Web of Toshiba, the first manual I opened a laptop shows me the UPC. HP manuals don't.

    I tried to call customer service. And both times I'm hung up or disconnected. It's very frustrating because I have a very basic question, and does not have I gotten a response yet.

    If someone can find the UPC for HP Pavilion a6230n and tell me how to get the Cup for HP products in the future, I would be very happy. Thank you!

    Hello @RYoder15,

    There is not much else I can suggest.  I tried at length to see if I could find anything in what concerns this information without success.  Maybe if you are able to find the product packed in the store?  I was able to find the product on Amazon here: HP Pavilion a6230n desktop PC

    I hope this helps.

    Kind regards!

  • How can I get the ul (code 101-8200) file so I can reinstall my printer?

    The printer was working fine until I got the message and the code. I don't know what caused it disappear. I tried to get the file with no luck. Help, please!     Thanks Bev1950

    Are you located in Europe (or attempt to print something that would be more 'normal' for a European country, as for the United States)?

    Kodak http://support.en.kodak.com/app/answers/detail/a_id/31863/kw/101-8200/selected/true says:

    How to solve "The UI File is Missing" error message (error code 101-8200)?

    To resolve the error:

    1. Install the EUupdate.exe file (updated European Union make Expansion) from the Microsoft Web site.
    2. Home Center software installation from the CD that came with your printer or at www.kodak.com/go/aiodownloads.

    If you have the latest version of the software and the error persists, there will be a malicious software on the computer. Run an anti-malware program to identify and remove malicious software.

    If the error persists, contact us.

  • How can I get the serial code for this product

    Hi, I can't find serail number to install my new photoshop elements it is not on the package, can anyone help thanks

    Serial number FAQ recovery process. Point-of-sale activation products

    Mylenium

  • My version 10.4 of Mac is not compatible so I deleted Firefox completely. How can I get the old version (one that works with my system) back?

    I have a Mac OSX 10.4.11. I installed the new update of Firefox and when I tried to open it, he said that it was not compatible with my compatible with my computer. I deleted it and now I would like to know how to install the old version of Firefox - or any version that works with my system. Thank you!

    Please change the download page for other people do not have this problem. He said that the new version works with Mac OS 10.4 and more - I checked before downloading. I'm happy, there is a solution, but the download page does not. Don't use other people waste their time like I did.
    When you download 3.6.24 new version downloads right thereafter. I closed it, but this looks like a glitch.
    Thanks again for your help and to continue to support the old version. Firefox is a great browser.

Maybe you are looking for