~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Howto for Oracle Forms & Reports Server and Client:
~ Release 6i, Debian woody Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Contents:


General:
    General Precautions

Server Configuration:
    Forms and Reports Server

Client Configuration:
    Forms and Reports Client
    Thin Clients
    Printing Reports via CUPS
    Fixing broken Keyboard Shortcuts
    Additional Info

Misc:
    My 2 ¢

the original of this document may be found here.




~ General Precautions:
~~~~~~~~~~~~~~~~~~~~~~

install libmotif, libmotif-dev, libmotif-dbg, xlib6g-dev
run ldconfig
add a group called 'dba' and a user called 'oracle' who belongs to this group.
:: i am assuming you want to install oracle in /u01 ::
Contents



~ Forms and Reports Server:
~~~~~~~~~~~~~~~~~~~~~~~~~~~


Environment:
(put those in a file which is executed on login, like /etc/profile, ~/.bashrc, or ~/.bash_profile if you use bash)

export ORACLE_BASE="/u01"
export ORACLE_HOME="/u01/app/oracle/product/6i"
export DISPLAY=":0.0"
export FORMS60_MAPPING="/dev60temp/"
export FORMS60_OUTPUT="$ORACLE_HOME/tools/web60/temp"
export FORMS60_REPFORMAT="HTML"
export FORMS60_PATH="ORACLE_HOME/forms60"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME/network/jre11/lib/linux/native_threads"
export ORACLE_AUTOREG="$ORACLE_HOME/guicommon6/tk60/admin"
export ORACLE_RESOURCE="$ORACLE_HOME/forms60/reource"
export ORACLE_TERM="386s"
export ORA_NLS33="$ORACLE_HOME/ocommon/nls/admin/datad2k"
export REPORTS60_CLASSPATH="$ORACLE_HOME/reports60/java;/usr/lib/jdk1.1/lib/classes.zip;$ORACLE_HOME/reports60/java/myreports60.jar;$ORACLE_HOME/reports60/java/xmlparser.jar"
export REPORTS60_DB_AUTH="dbauth.htm"
export REPORTS60_JNI_LIB="$ORACLE_HOME/network/jre11/lib/linux/native_threads/libjava.so"
export REPORTS60_PATH="$ORACLE_HOME/reports60"
export REPORTS60_SHARED_CACHE="YES"
export REPORTS60_TMP="$ORACLE_HOME/tools/web60/temp"
export TNS_ADMIN="$ORACLE_HOME/network/admin"

I additionally used these:
export DEBUG_SLFIND="debug.log" for debugging
export NLS_LANG="GERMAN_GERMANY.WE8ISO8859P1"
export REPORTS60_NO_DUMMY_PRINTER="TRUE" if you have no printer installed

apart from that put $ORACLE_HOME/bin in your $PATH.
DONT include $ORACLE_HOME/lib in /etc/ld.so.conf. it will mess up the libs and your forms
will look terrible and unusable after running ldconfig.

make sure that the commands "hostname" and "domainname" return valuable results.
as "domainname" does not exist on debian woody make a script /bin/domainname which looks like that:


######################
## script start
######################

#!/bin/bash
dnsdomainname
exit 0

######################
## script end
######################

download this script.


for some reason a simple symlink does not work.
chmod it to 755 and run it to make sure that it works because forms server will refuse to run
if "domainname" or "hostname" return (none).
make sure that the TWO_TASK environment variable is unset.
select 'custom install' and select "oracle forms server and client" and
"oracle reports server and client". the installer will select lots of other stuff automatically.
installation should not output any errors. if you get relinking failures you did not install libmotif-*.
being asked for the connect method (socket, http, https) ALWAYS choose sockets because the other methods
simply don't work! at the end a message pops up, which tells you how to configure aliases for your http server.
follow the instructions and dont forget to define the cgi directory as "ScriptAlias" if you use apache.
due to a bug in the f60cgi executable you have to create a directory /forms60/server/ and symlink
$ORACLE_HOME/forms60/server/formsweb.cfg there, because the f60cgi executable will not run without
this file being right there.
copy your tnsnames.ora and sqlnet.ora files to $TNS_ADMIN directory.
(you can verify your tnsnames.ora file by executing "tnsping oracledbservername")


special configuration for reports server:
edit your tnsnames.ora file to show a line:
rep6i=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname.domain.com)(PORT=1951)
at the end of the file. make sure it is all in one line (no newlines or escape chars).

the reports server will NOT run if there is no valid display and a windowmanager running and if
the $DISPLAY var is not set correctly. you can either install xwindow system
AND log in as any user or use "Xvfb" which is an xserver emulator.
note, that you also need a window manager.
i used "mwm" because it is very small and doesnt need a lot of resources.
install Xfvb and mwm.
i used this script to start the x emulation and forms and reports server:
(put it into /etc/init.d and link it to your runlevels to start the servers on bootup)



####################################################################
## script start
####################################################################

######################
#!/bin/bash
# /etc/init.d/oracle_servers
#
# script to start oracle forms and reports server and a
# fake X server needed by reports server
#
######################

ORACLE_HOME="/u01/app/oracle/product/6i"
FORMS_SERVER="$ORACLE_HOME/forms60_server"
REPORTS_SERVER="$ORACLE_HOME/reports60_server"
ENVIRONMENT_FILE="$ORACLE_HOME/.bash_profile"
FAKE_X="Xvfb :0 -screen 0 800x600x8 &"
FAKE_WM="mwm &"
DISPLAY=":0.0"
USER="oracle"


######################
case "$1" in
    start)
        cd $ORACLE_HOME
        source $ENVIRONMENT_FILE

        echo "Starting fake X..."
        su - $USER -c "$FAKE_X"
        echo "...done."

        export DISPLAY=":0.0"

        echo "Running xhost +..."
        su - $USER -c "xhost +"
        echo "...done."

        echo "Running fake windowmanager..."
        su - $USER -c "$FAKE_WM"
        echo "...done."

        echo "Starting Forms Server..."
        su - $USER -c "$FORMS_SERVER start"
        echo "...done."
        echo "Starting Reports Server..."
        su - $USER -c "$REPORTS_SERVER start"
        echo "...done"
    ;;



    stop)
        echo "Stopping Forms and Reports Server..."
        $FORMS_SERVER stop
        $REPORTS_SERVER stop
        echo "...done"
        echo "Killing the fake X server and windowmanager..."
        kill -9 `pidof mwm`
        kill -9 `pidof Xfvb`
        echo "...done"
    ;;


    restart)
        $0 stop
        sleep 1
        $0 start
    ;;


    *)
        echo "Usage: $0 {start|stop|restart}"
    ;;
esac
exit 0
####################################################################
## script end
####################################################################

download this script.


to get debug info from forms server you can add "log=yourdesiredlogfile.log to the start command
("$FORMS_SERVER start log=blahblah.log")
to get debug info from reports server you need to export DEBUG_SLFIND="reportslogfile.log"
be sure to remove the logging when everything works, because the logfiles will soon fill your disk....
Contents


~ Forms and Reports Client only installation:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


one important thing at the beginning. other than in windows in linux you have to use the following:





forms:*.fmxsame as in windows
reports:*.rdf(not the *.rep like in windows, you will get
'Rep-0002 unable to retrieve a string from Report
Builder Message file' if you have a *.rep file with
the same base name in the $REPORTS60_PATH)
libs:*.plxsame as in win too.


Environment:
(put those in a file which is executed on login, like /etc/profile or ~/.bash_profile if you use bash)

export ORACLE_BASE="/u01"
export ORACLE_HOME="/u01/app/oracle/product/6i"
export DISPLAY=":0.0"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME/network/jre11/lib/linux/native_threads"
export ORACLE_AUTOREG="$ORACLE_HOME/guicommon6/tk60/admin"
export ORACLE_TERM="386s"
export TNS_ADMIN="$ORACLE_HOME/network/admin"
export TWO_TASK="yourdbservername"

I additionally used this:
export NLS_LANG="GERMAN_GERMANY.WE8ISO8859P1"

make sure ORA_NLS33 is unset. you will get a "window system startup failure" if this is set.
make sure the TWO_TASK variable is set; this will make the installer see the installation as "client only installation"
fire up the installer and choose "oracle forms and forms server" and "oracle reports and reports server",
the installer will automatically install lots of other stuff too.
the installer will probably ask you to configure you web listener (web server) at the end of the
installation procedure. you can skip this if you are installing a client only.
installation should not output any errors. if you get relinking failures you did not install libmotif-*.

if installation goes well you can start forms designer by executing "f60desm" and reports builder by executing "rwbld60".
if the forms designer and reports builder look terrible on first startup you might have included $LD_LIBRARY_PATH in
/etc/ld.so.conf which i warned you not to :).
to get decent looks out of it you should at first install "xfs-xtt" and some fonts and enable them by adding
"FontPath unix/:7110" to your /etc/X11/XF86Config.
then copy $ORACLE_HOME/guicommon6/tk60/admin/Tk2Motif.gray (or whatever colorscheme you wish)
to $ORACLE_HOME/Tk2Motif and edit the file to fit your needs (i.e. replace all default font sizes 100 with 120)

depending on how you programmed your forms you might come into the situation, that the field sizes are far
too small for the letters to fit in. there is no direct way with oracle configuration to globally change
that but since the fonts are unreadable in that case there is another way to work around this.

since XFree86 version 4.x there is a parameter called "DisplaySize" which you can put into your "Monitor" section in XF86Config-4 to globally
fine-adjust the dpi of your xserver. obviously this setting has no effect on most applications
but it works with oracle though there is a little catch;
this setting has NO effect if the xserver is started with "startx". there must be some
display manager (xdm, gdm, kdm) running to make this setting work. the "Monitor" section
on my client machines look like this:

#######################################
## /etc/X11/XF86Config

Section "Monitor"
Identifier "My Monitor"
HorizSync 30-70
VerrtRefresh 50-160
Option "DPMS"
DisplaySize 232 174
EndSection

#######################################

The format of the "DisplaySize" parameter is "DisplaySize horizontal_size_in_mm vertical_size_in_mm".
to get optimal results you should bear in mind that the relation h:v should be 4:3.

IMPORTANT: If you use kdm as login manager you must remove the "-dpi=100" entry from /etc/kde2/kdm/Xservers
(or the appropriate file if you use kde3) because this will override the settings in XF86Config.

Contents




~ Thin Clients
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




if you are using forms and reports server to connect your clients to your database, you will want to make a thin
clients installation. this means that no client software is installed on the clients but they are
connected via the forms/reports server to the db using either the j2re appletviewer or a java applet in netscape 4.x or konqueror.


important notes:

the applet viewer ONLY works for forms because it can ONLY interpret applet tags.
since the reports come in html or pdf format the applet viewer can not display them.
netscape 6/7 or mozilla will not work because they use java 1.3 and
forms/reports server 6i use java 1.2.
there is a plugin from oracle called "jinitiator"
which at this time (september 2002) is only available for win32 platforms.
only netscape 4.x will display the applets correctly out of the box.
konqueror can be configured to work fine, if jre 1.2 is installed
and konqueror is configured to use it. more info about this can be found at
http://www.konqueror.org/konq-java.html.


to access your forms and reports from the thin clients use the following:

appletviewer "http://your.forms+reports.server.com/dev60cgi/f60cgi?form=yourform.fmx&width=1024&height=680&userid=user/password@db"

or just type in netscape's location field:

http://your.forms+reports.server.com/dev60cgi/f60cgi?form=yourform.fmx&width=1024&height=680&userid=user/password@db

width, height and userid are optional.

-------

i found no possibility to get reports to work directly from the browser. the manual says you have to type

http://your.forms+reports.server.com/dev60cgi/rwcgi60?report=yourreport.rdf&width=1024&height=680&userid=user/password@db

into your browsers location field but i always got an emty html document.
however you can make reports work by calling
them from within a form (runproduct) which i think is the usual way anyway.
Contents



~ Printing Reports via CUPS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




Alright, so you've gotten this far but now your boss wants to view your company's reports printed on paper.
Dont panic; at least not yet. Panicking time will come later.
Oracle Reports uses the file $ORACLE_HOME/guicommon/tk60/admin/uiprint.txt as its printer definition file.
This does not mean that printing will work as soon as this file is configured perfectly. You also need to have
a properly configured /etc/printcap since reports validates the uiprint.txt by requesting the specified
printer from /etc/printcap. This is especially a problem when you dont use lpr or lprng to print,
but CUPS, as we do.
At the time of this writing CUPS uses /etc/printcap.cups but i read on the CUPS homepage that this will change soon.
Well, you can work it around by setting up a fake /etc/printcap containing the names and
a little additional info. Mine looks like this:

lp1|HP 8150 simplex top bin:\
    :sd=/var/spool/lpd/lp1_1:\
    :mx#0:\
    :sh:\
    :rm=localhost:\


(Add all printers you want to access from reports here.)

For me it was impossible to get the oracle toolkit to accept any *.PPD files (apart from default.ppd)
as suggested in the manuals, I always got toolkit errors and the like, so initially
i had no possibility to get any duplex printing to work!
The solution is, to add each printer multiple times;
i.e. have lp1 be printer1 ==> simplex, lp2 will be printer 1 ==> duplex ... you get the point.
Configure each printer accordingly in CUPS using your printer manufacturers PPD files
(put them in /usr/share/cups/model/ to make them available via the nice CUPS web-interface).
CUPS is very easy to configure and lets you access all the nice and handy functions that
today`s manufacturers build into their latest products.

Finding out why duplex printing worked with EVERY application except Oracle reports cost me some sleepless nights.
Due to a bug in the reports postscript rendering engine, the postscript header gets written correctly,
but is then reset in the subheader of each page. This means that you need a script that deletes all the page-specific
simplex/duplex info from each report that gets sent to a printer. With some help from Rajesh Ramachandran,
i could solve the problem with a sed script. Here the original answer from Rajesh
that after hundreds of non duplexed printouts really saved my day:

Write a sed script file called 'duplexsed' with the following three lines.

    /^%%BeginPageSetup/,$ {
    /^%%BeginFeature/,/^%%EndFeature/d
    }

download this script.

Copy the file to an appropriate directory, for example $ORACLE_HOME/bin.
Set the environment variable TK_PRINT:
export TK_PRINT="sed -f $ORACLE_HOME/bin/duplexsed | lpr -l -s -P'%n' -#'%c'"


This is actually the only way to get duplexed printouts from reports6i.
But hang on, there's still more to come:

In our company we use reports that contain images. Ok that is no big deal.

BUT:
When you want to print something the reports rendering engine produces a PostScript file (*.ps) which
if TK_PRINT is set goes through the command in TK_PRINT or otherwise through the command in
$ORACLE_HOME/reports60/admin/printer/spoolcmd.sh
If the report contains an image the file will be in Encapsulated PostScript format (*.eps)
containing the binary full size, full resolution, full bit depth UNCOMPRESSED image.



In our special case that meant that a report containing a 150 kB *.gif ended up becoming a
70 MB *.eps file being sent to the printer.
I would say this is the right moment to panic.



I have not found a satisfying solution for this issue so far but yet another workaround :)

This script uses ghostscript to convert the *.eps stream that comes from reports to pdf format and
pipes it into the printer command. I know that this is not the most elegant way, but so far it seems to be
the only one possible.

The resulting *.pdf file weighs about 750 kB which is almost 100 times smaller than the original *.eps

To make it work the printer COLORPRINTER (here lpx) must point to your installed printer which you wish to use
for printing reports with images.

#######################################################
#!/bin/bash
#
# this script reads a postscript file from stdin and
# converts it to pdf using ghostscript. it takes 2 args:
# arg1 = printer name
# arg2 = number of copies to print
#

COLORPRINTER=lpx
    if test $# -lt 2
        then echo "Not enough arguments."; exit 1
    fi

    if test $# -gt 2
        then echo "Too many arguments."; exit 1
    fi

    if [ $1 == $COLORPRINTER ]; then
        gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- /dev/stdin | lpr -P$1 -\# $2
    else
        cat /dev/stdin | lpr -P$1 -\# $2
    fi

#######################################################

download this script.

To finally make it work save this script as $ORACLE_HOME/bin/picprint, chmod it to 755 to make it executable
and set the TK_PRINT variable so that reports uses it:
export TK_PRINT="sed -f $ORACLE_HOME/bin/duplexsed | $ORACLE_HOME/bin/picprint '%n' '%c' "



As soon as i can gather any information about a better way to solve this i will update this section immediately,
since on a fast computer (or at least whats considered fast in september 2002, like 1600 MHz, 512 MB) one page takes
about 2 min 30 sec to get to the printer. On a 450 MHz PC with 64 MB it takes almost 11 minutes to print 1 page :(
There will have to be a better way for this, also does reports only generate a 3.5 MB sized file from the same report.
Contents



~ Fixing broken Keyboard Shortcuts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




After generating a resource file for our custom keyboard shortcuts using oraterm
(the resource files reside in $ORACLE_HOME/forms60/admin/resource/{yourcountry}) and starting some of our forms
i had to realize that many of the shortcuts only worked, when NumLock was turned off. Reverting to the
original resource file I could only see that the same was the case. I found out that since X11R6
the NumLock button is treated as a "modifier key" such as ctrl or alt. Its assignment in the default keymaps
is mod2. This means that any key pushed sends a different or no signal if NumLock is on, depending on the used keymap.
to change this i copied one of the standard xmodmap files from /usr/share/xmodmap/ to $ORACLE_HOME/.Xmodmap
and included the approproiate xmodmap command in my oracle start scripts which you can find in the
"Additional" section.
I do know that there are other ways to get this done but since i am distributing the oracle installation as
a *.deb package within our company i want to keep the scripts and necessary files as simple and overviewable
as possible. Apart from that i do not want to modify too many system files to avoid interfering with other
applications using the same files. At this time i am using only the four startscripts outside the /u01 directory
which in my opinion is alright :)




~ Additional info
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




For ease of use and to have better control over the environment variables (and of course so that every
user can have their own configuration but if something goes wrong can fall back to a valid default config)
i have added these 4 little scripts to /usr/local/bin/ to start the needed applications nicely:


#!/bin/bash
# /usr/local/bin/forms60designer

export ORACLE_BASE="/u01/app/oracle"
export ORACLE_HOME="$ORACLE_BASE/product/6i"
source $ORACLE_HOME/.profile
if [ -a $HOME/.profile ];then
source $HOME/.profile
fi
f60desm $*

download this script.





#!/bin/bash
# /usr/local/bin/forms60runtime

export ORACLE_BASE="/u01/app/oracle"
export ORACLE_HOME="$ORACLE_BASE/product/6i"
source $ORACLE_HOME/.profile
if [ -a $HOME/.profile ];then
source $HOME/.profile
fi
f60runm $*

download this script.





#!/bin/bash
# /usr/local/bin/reports60builder

export ORACLE_BASE="/u01/app/oracle"
export ORACLE_HOME="$ORACLE_BASE/product/6i"
source $ORACLE_HOME/.profile
if [ -a $HOME/.profile ];then
source $HOME/.profile
fi
rwbld60 $*

download this script.





#!/bin/bash
# /usr/local/bin/reports60runtime

export ORACLE_BASE="/u01/app/oracle"
export ORACLE_HOME="$ORACLE_BASE/product/6i"
source $ORACLE_HOME/.profile
if [ -a $HOME/.profile ];then
source $HOME/.profile
fi
rwrun60 $*

download this script.

Contents











This howto is neither supposed to be complete or proven correct in any kind of way.
Neither do i guarantee the scripts work in every environment or on any other operating system.
It just reflects the experiences i made installing these Oracle products.
And because it took me quite some time to get things running, i decided
to write this howto to possibly save some time for anybody being in the same
situation fighting with the documentation of the oracle 6i product series for linux :)
(just my 2 ¢)

Have Fun!
Linux Rocks!



This page has been optimized for lynx ;)