Wednesday, March 13, 2013

Tip to ease Deployment on Linux of an Oracle Forms developed on Windows

You are using Windows on your desktop to run Oracle Forms Builder 10g or + to develop or maintain Oracle Forms applications.
Your Forms server is setup on a Linux machine, in my case Oracle Linux 5 64bit running Oracle Forms 11.1.2.1.

Each time a Forms is recompliled following a modification, you need to recompile the binary fmb file using frmcmp.sh on Linux to produce the fmx before being able to access the new form from the Forms server.

This step can be annoying because you have to first transfer the fmb file to the Linux server, than log in to the Linux server via telnet, ssh or some other remote control utility and run the frmcmp script.

To speed the process, I have done the following :-
1/. Setup openssh on my windows desktop where Forms builder is installed (You can download here)
2/. Map the folder where the fmx are located on the Forms server (as per the FORMS_PATH parameter). In my case, the location is on a Netapp filer and that location is mounted via NFS on the Forms server and via CIFS on my Windows development machine.
3/. Add a file context menu for all fmb file in Windows to run a .bat script that executes an ssh command on the linux server to run frmcmp taking in parameter the filename selected in Windows.


To achieve this, you can refer to this "How to" article .
The BAT script is as simple as this :-


ssh oracle@myformsServer.domain.com "/Oracle/Middleware/asinst_1/bin/frmcmp.sh Module=/WEBFRM/%~nx1 Userid=mydblogin/mydbpassword@mydb Module_type=FORM Logon=YES Compile_All=YES"
                                                  
PAUSE

oracle@myformsServer.domain.com is <Linux user>@<the FQN of the Forms server>.
/Oracle/Middleware/asinst_1/bin/frmcmp.sh is the path for the frmcmp.sh script.
/WEBFRM/ is the path as mounted on the Forms server for the fmb files.

To make sure frmcmp.sh works, you can set the environment directly at the beginning of the frmcmp.sh file (make a backup of the orginal file before editing) as follow:-

DISPLAY=:0.0
export DISPLAY
#the rest is similar to the oracle account environment you usually set in the oracle profile in /home/oracle
JAVA_HOME=<your JDK path where bin is located>
export JAVA_HOME
ORACLE_INSTANCE=<your Middleware instance path>
ORACLE_HOME=<Your forms home path>
export ORACLE_INSTANCE ORACLE_HOME
PATH=$ORACLE_HOME/bin:$ORACLE_INSTANCE/bin:..etc...
export PATH


With this in place, when an Oracle Form is modified and compiled on Windows, I just have to right-click on the file, choose my custom context menu option which I have called "Compile fmb for Linux"; the fmx is generated after compilation and I just have to copy that fmx to the production/deployment mapped drive.