After upgrading the database 10g to 11g the forms HOST command no longer works on Unix server. The form used to work fine prior the upgrade. I read all the threads I could find and did not see any solutions. Adding PATH and LD_LIBRARY_PATH does not work because it does not even run a basic shell script. (I saw this solution, adding PATH and LD_LIBRARY_PATH, in many questions / threads).
1. I wouldn't expect the database upgrade to be an issue, but it is the only change we had.
2. Note, 11g is Oracle Fusion Middleware which is quite a bit different than 10g.
I even tried the most basic commands like "echo" which is a build-in Unix command and there is no directory for it (ie. no /usr/bin - so variable PATH is irrelvent). i.e HOST('echo hi'); and HOST('echo "hi" '); and even HOST ('echo hi > /my_file.txt'); all returns FORMS_FAILURE (actually the if is IF FORM_SUCCESS THEN ... else ... and the else part always runs now - whereas it didn't before.).
Or basic commands like /usr/bin/ls as in HOST(/usr/bin/ls). At that point I was just testing the Unix command would return FORM_SUCCESS even though I could not see the results (because they weren't writing to a log file). Notice that I'm using the direct path /usr/bin so no Unix environment variables were needed.
The form does use webutil but that part works. For example, we have webutil_file_transfer( ....) The file shows up on the application server and in the expected directory.
Here's the main goal. Upload a file from clients local PC to the datebase server. The form uploads the file to the Application server, then we have a Unix script to scp (secure copy) the file from the application server to the database server. IF webutil, or any other Oracle functions could put the file on the database server that would be better. But, I don't know of any procedures that do that - or would have done it cleanly (i.e. storing to database and write back to server and then using a blob etc. )
Anyway, I was hoping someone would help with either of these.
1) Get the HOST command to work. - If we can get that to work then I wouldn't need any more help. We can just call the already existing Unix script to copy the file from the application server to the database.
2) OR be able to upload directly to the database server - wanted to do that originally
It is unlikely that a db upgrade has anything to do with your issue. As for why it may have worked before and not now... well I cannot answer that.
Generally, I like to describe how HOST works like this. The HOST built-in provides a way to execute OS commands from Forms through a shell (or DOS for Windows). However, it should be assumed that the shell being spawned is bare. Meaning that most or all of the system variables are not included. This means that even most of the simple/common commands will fail. I often recommend that you do not call a command directly. Instead, wrap in a script so that you take control over exactly how it should run. Try something simple. For example create a simple script which first sets the important variables like PATH, LD_LIBRARY_PATH, etc. Then try copying a file from place to place (e.g. cp foo.txt foobar.txt). From Forms, use HOST to call the script.
Also, here are two things to consider:
1. The installation owner must be the user that starts the instance
2. Be sure, in my example, that the file you create was created while logged in as the installation owner.
Solution for those interested and for anyone else searching this forum for a solution
I found this on My Oracle Support:
<h3>Host Command from Forms Not Working in 11g in Sun Solaris Sparc OS [ID 1157346.1]</h3>
Applies To: Oracle Forms - Version 18.104.22.168.0 and later
Sun SPARC Sun OS
When trying to execute a Shell script or any OS command using the host() Built-in from Forms 11g, the host()command is not getting executed. The same functionality works on other operating systems and in previous versions like 10gR2.
Steps to be followed:
1) Take a backup and edit the $DOMAIN_HOME/config/fmwconfig/servers/WLS_FORMS/applications/formsapp_11.1.1/config/default.env or any custom environment file.
3) a) Instead of LD_PRELOAD, kindly use LD_PRELOAD_64 as given below :
(This makes HOST AND RUN_REPORT_OBJECT work fine).
4) Save the file and execute your forms. The Host() built-in will work as expected
The LD_PRELOAD setting in default.env is only required for the working of signal chaining facility in JVM version 1.5 and later. If you are not using theSignal chaining facility, this variable is not required. For more information, refer to the following documentation