28.10.08

Adding encoding -processing Instruction to XML When Using File Adapter

By default when using Oracle File Adapter to produce XML documents, no encoding="<charset>" attribute is used in the <?xml version="1.0"?> processing instruction.

Default PI:

<?xml version="1.0" ?>

and wanted PI:

<?xml version="1.0" encoding="UTF-8" ?>

 

The way to make this work (at least in 10.1.3.4) is to update the XML schema to include two new options in the schema definition.

           xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
           nxsd:encoding="UTF-8">

So, adding these attributes will make the schema look like:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.fi.oracle.com/harri.kaukovuo"
           elementFormDefault="qualified" attributeFormDefault="unqualified"
           xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
           nxsd:encoding="UTF-8">
<xs:element name="ORDERS">
...

</xs:element>

</xs:schema>

21.10.08

Great utility to free up disk space: JDiskReport

There is not enough of disk space. No matter how large hard disk you get, it will get filled up eventually.

 

After having only 20MB of free space on my C: -drive, I finally take a closer look at the utilities that can point me the directories and files that are reserving the most of the disk space. I found this great utility:

http://www.jgoodies.com/freeware/jdiskreport/index.html

Good looking, graphical, Java -based, free and easy to use utility to show exactly what are the directories and files consuming the most of your disk space.

After scanning thru my C: and D: drives I could purge almost 13 GB of meaningless files.

8.9.08

Voi räkä!

I am running Google Chrome Beta and faced an issue with the browser. The error message is a bit interesting when shown in Finnish language:

image

Funny indeed :)

4.6.08

JMSUtils

There is a built-in utility to browse/move/delete(drain) messages from JMS queues and topics inside OracleAS OC4J. Starting of the utility has changed a little bit from version 10.1.2 but the usage is the same.

For those that want the fast way of starting up this utility, here is a sample Windows command file:

Create a new file, e.g. called JMSUtils.cmd and the contents:

@REM JMSUtils.cmd
@REM    This script will launch OracleAS OC4J 10.1.3. JMS command line utility
@REM History:
@REM   4.6.2008 Harri Kaukovuo, Oracle Finland Oy
@set J2EE_HOME=D:\product\10.1.3.1\OracleAS_1\j2ee\home
@setlocal
@set CLASSPATH=%J2EE_HOME%\oc4j.jar;%J2EE_HOME%\oc4j-api.jar;%J2EE_HOME%\oc4jclient.jar;%J2EE_HOME%\rmic.jar;%J2EE_HOME%\lib\adminclient.jar;%J2EE_HOME%\lib\connector.jar;%J2EE_HOME%\lib\javax77.jar;%J2EE_HOME%\lib\jmxri.jar;%J2EE_HOME%\lib\oc4j-internal.jar
@java com.evermind.server.jms.JMSServerUtils -username oc4jadmin -password yourpassword -port 12601 %*
@endlocal

You need to replace the value for J2EE_HOME to point to your OracleAS OC4J home directory. By default this utility points to the local host, but you need to connect remote OC4J please add extra "-host myhost.com" as startup uption. To determine the right JMS server port, please see the following chapter.

Determing JMS server port

OPMN

Depending on the installation (SOA Suite basic, advanced, WebCenter, standalone OC4J), the JMS server setting might be different. One of the easiest way to determine this when running a real OracleAS installation is to use OPMN command line tool:

opmnctl status -fmt %por

Processes in Instance: soasuite.hkaukovu-fi
-----
ports
-----
N/A
jms:12601,http:8888,rmis:12701,rmi:12401

As you can see, the JMS server port among others is reported as an output. You should use the jms:XXXX value in the JMSUtils.cmd command script as -port option.

opmnctl is found under $ORACLE_HOME/opmn/bin.

 

Standalone OC4J

If you are running standalone OC4J (not installed using Oracle Universal Installer), you should look for $OC4J_HOME/j2ee/home/config/jms.xml file. The entry

<jms-server port="9129">

will show you the port number.

In the above sample the "home" in the path $OC4J_HOME/j2ee/home/config points to the default OC4J instance name "home". In case you have multiple OC4J instances you might be different subdirectories for each instance (like oc4j_soa etc).

Please be aware that if you use OPMN to control the instance, the value in jms.xml will be overriden by OPMN driven values derived from opmn.xml "<port id="jms" range="12601-12700"/>".

15.4.08

ODI Agent and AD4J Diagnostics Console

I was playing with Oracle's new java application diagnostics tool called Oracle Application Diagnostics for Java (AD4J).

http://www.oracle.com/technology/software/products/oem/htdocs/jade.html

http://www.oracle.com/technology/products/oem/pdf/wp_productionappdiagnostics.pdf

This is great tool to monitor the guts of Java or J2EE engine.

 

AD4J manuals describe how to install the JADE agent on OracleAS or BEA WebLogic, also decribing how to configure standard Java application with agent.

For those that want to monitor Oracle Data Integrator (ODI) agents, here are the steps in details.

1. Download the "Java Agent ZIP File"

image

2. Place the zip file on ODI installation in $ODIHOME/drivers -directory.

3. Edit the agent.bat (or agent.sh on Unix) to replace the

%ODI_JAVA_START% oracle.odi.Agent %*

with

%ODI_JAVA_START% jamagent.jamrun jamconshost=localhost jamconsport=3600 jamjvmid=1000 oracle.odi.Agent %*

Here you should replace jamconshost parameter value with the hostname that has AD4J console running. Also if jamconsport is different than 3600, change the value. Jamjvmid is the identifier that shows up in the JVM list as "port" identifying the JVM from others:

image

4. Once the agent.bat or agent.sh is modified (alternatively you made a copy of the agent startup script), you can start it and should see the ODI agent JVM showing up in the AD4J console.

21.3.08

Adding Oracle ODI Agent execution under OPMN control

I was talking to a customer and explaining opmn and it's role acting as main process control for OracleAS and custom components. While talking also about Oracle Data Integrator (ODI) agents and how to start them up, it occured to my mind to test how to place agent startup/shutdown under opmn control.

Adding your own scripts and executables under opmn control as part of the whole OracleAS package is supported and described in the OPMN manual.

Here is how it goes when adding ODI Agent:

Modify and edit following XML fragment and paste it on $ORACLE_HOME/opmn/conf/opmn.xml

....

<ias-component id="OdiAgent" status="enabled" id-matching="false">
    <environment>
       <variable id="ODI_JAVA_HOME"
                 value="D:\product\10.1.3.1\OracleAS_1\jdk" append="false"/>
       <variable id="ODI_HOME"
                 value="D:\product\odiclient\oracledi" append="false"/>
    </environment>
    <process-type id="OdiAgent" module-id="CUSTOM">
       <process-set id="OdiAgent" restart-on-death="true" numprocs="1">
          <module-data>
             <category id="start-parameters">
                <data id="start-executable" value="D:\product\odiclient\oracledi\bin\agent.bat"/>
                <data id="start-args"
                      value="-PORT=20900 -NAME=MYAGENT"/>
             </category>
             <category id="stop-parameters">
                <data id="stop-executable"
                      value="D:\product\odiclient\oracledi\bin\agentstop.bat"/>
                <data id="stop-args" value="-PORT=20900"/>
             </category>
          </module-data>
       </process-set>
    </process-type>
</ias-component>
...

 

Starting the ODI agent is done by:

opmnctl startproc process-type=OdiAgent

 

Stopping the ODI agent is done by:

opmnctl stopproc process-type=OdiAgent

 

After restarting or reloading the opmn you can see ODI agent starting up and showing up in the status list:

D:\product\10.1.3.1\OracleAS_1\opmn\bin>opmnctl status

Processes in Instance: soasuite.hkaukovu-fi
---------------------------------+--------------------+---------+---------
ias-component                    | process-type       |     pid | status
---------------------------------+--------------------+---------+---------
OdiAgent                         | OdiAgent           |   20780 | Alive
ASG                              | ASG                |     N/A | Down
OC4JGroup:default_group          | OC4J:home          |   31364 | Alive

20.3.08

Switching BPEL Process File Based Decision Service to WebDAV Based

You might get into a situation where you have started the BPEL Process development using file based business rule repository and noticed later on that you should have been using WebDAV instead.

 

Once you have defined the file based business rule service in BPEL process, the file repository is actually copied under the deployment structure:

<BPEL process>/decisionservices/<servicename>war/WEB-INF/repository

Please note that making any changes on the original rule file will not have any effect on the rule repository deployed and copied with the BPEL process. This is why using WebDAV repository has it's clear role as central place for business rule repository.

 

How to change file repository to WebDAV?

It is possible to replace the file based repository definition to use WebDAV based repository, with surgical operation on BPEL decision service deployment files.

 

0. Make a backup of the BPEL process you intend to modify.

1. Make sure you have the latest business rule repository imported in the WebDAV location. If you don't have that, you can just connect to WebDAV repository from the rule author application and press "Import" to import the file repository file as such. This will extract the file repository contents into WebDAV file structure. Do not copy the file repository "as is" into WebDAV folder as this will not work. You need to import it using rule author.

 

2. (Optional) Create an empty BPEL process and drag&drop a decision service to the process. Define a decision service to use the wanted WebDAV rules connection. Please note that this step is only done to get the needed XML fragment from decisionservices.decs -file.

<repository type="WebDAV">
  <webdav>
    <url>http://myhost:7777/rule_repository/poc/</url>
    <username>harri</username>
    <password encrypted="true">dsIJkj9898dh</password>
  </webdav>
</repository>

3. Open up the actual BPEL process project. Navigate to the file system level to see the decision service deployment directory that was created behind the scenes the first time you defined the decision service using file based repository.

 

Look for decisionservices.xml under:

<BPEL process directory>\decisionservices\<servicename>\war\WEB-INF\classes

 

The file has the configuration info for the decision service, among others something like this:

<repository type="File">
  <file>repositoryresource:MyRuleSets</file>
</repository>

Replace that with (extracted from an existing decisionservices.decs -file from step 2):

<repository type="WebDAV">
  <webdav>
    <url>http://myhost:7777/rule_repository/poc/</url>
    <username>harri</username>
    <password encrypted="true">dsIJkj9898dh</password>
  </webdav>
</repository>

... and save.

 

What I did was also removed the rules repository from:

<BPEL process directory>\decisionservices\<servicename>\war\WEB-INF\repository

just to make sure the service is not using the file based rule repository any more.

 

4. Redeploy the BPEL process.

5. Test.

You should now be using the WebDAV based rules repository with your BPEL decision services.

31.1.08

New syntax for Oracle WSM 10.1.3.3 wsmadmin md5encode

For those that might have seen OWSM md5 hash encoding utility (e.g. for .htpasswd file), there has been a slight change in the syntax and parameters for 10.1.3.3:

wsmadmin md5encode <file> <username>

the old syntax (10.1.3.1) was instructed like:

wsmadmin md5encode <username> <passwd> <file>

Latter doesn't work in WSM 10.1.3.3 any more.

30.1.08

Axis2 Web Services Container on OC4J

I was working on a project to call Oracle Data Integrator (ODI) from Oracle ESB as part of integration scenario. Part of the ODI installation is to set up infrastructure for public web services, that e.g. allows to call ODI integration scenarios remotely using Web Services calls. ODI Public Web Services uses Apache Axis2 as the web services container.

Installing Axis2 on OC4J 10.1.3. was a real "as easy as 1-2-3" task. Downloaded the WAR Distribution zip file from http://ws.apache.org/axis2/download.cgi, unzipped it on my hard disk and then deployed it using Oracle Application Server control.

After Axis2 WAR deployment, the web services container was ready to rock and to upload the odi-public-ws.aar file required by ODI.

This is just as a reminder for people that wonder how to work with Axis2  and OracleAS.

11.1.08

Unconventional Oracle Installation

Some competitors claim Oracle DB installation takes many days and lots of resources.

These Danish hard core Oracle professionals prove this is not true:

http://www.youtube.com/watch?v=CHzV4LZnvHc

 

Please don't try this at home, at least alone ;)

23.8.07

Missing ODBC connection strings?

Here is a cool site for instructing how to define OCBC connection strings for different data sources:

http://www.connectionstrings.com

Oracle BAM 10.1.3 External Data Source and Access DB

When preparing for a BAM demo I needed to show information from BAM external data source (MS Access sample database Northwind). Manual only described how to configure Oracle Database, but didn't give a sample how to configure Access DB.

After a while of tweaking out the configuration I got Access DB set up as an external data source. The key is to define following values as a sample:

Driver: Microsoft Access Driver (*.mdb)

Connection string: Dbq=d:\demodb\Nwind.mdb;

26.7.07

OpenCMS 7.0.1 and Jetty

Finally had some time to play around with OpenCMS again. This time trying to get OpenCMS running on Jetty servlet engine.

Installing on Jetty is pretty straight forward. Just downloaded the OpenCMS zip file, unpacked the war file under $JETTY_HOME/webapps/opencms and extracted the war file with jar xvf opencms.war.

After bouncing the Jetty engine and trying to startup the OpenCMS setup screen I got an exception:

2007-07-25 19:21:06.019::WARN:  EXCEPTION
javax.servlet.ServletException: Critical error during OpenCms initialization: The OpenCms setup wizard is still enabled.
        at org.opencms.main.OpenCmsServlet.init(OpenCmsServlet.java:262)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:400)
...

This actually caused the whole Jetty engine to misbehave since I could not any more use other applications on the Servlet engine. And naturally the OpenCMS could not be started at all.

Downloaded the source code from read-only CVS repository and looked at the problem. This seems to be the same issue as with BEA WL9, so I needed to uncomment the "OnErrorExitWithoutException" parameter setting under $JETTY_HOME/webapps/opencms/WEB-INF/web.xml.

After uncommenting the servlet parameter and bouncing the Jetty engine I was able to startup OpenCMS setup screen successfully.

25.5.07

Running Liferay on OracleAS 10.1.2

Liferay portal installation on OracleAS 10.1.2 doesn't necessarily follow the installation instructions mentioned in the liferay.com site.

Here are the rough steps to configure Liferay 3.0.6 on OracleAS 10.1.2. J2EE and Web Cache installation.

1. Download the Liferay EAR file. Follow the instructions to update the config files mentioned in the Liferay home pages.

2. Liferay uses different XML parser that is by default configured in OracleAS 10.1.2. To make the container use Xerces parser you need to set up parameters for starting up the container. Make sure you change the "/home/oracle/xerces/xerces-2_9_0" path to reflect your environment.

Edit opmn.xml:
         <ias-component id="OC4J">
            <process-type id="home" module-id="OC4J" status="enabled">
               <module-data>
                  <category id="start-parameters">
                     <data id="java-options" value="-server -Doc4j.userThreads=true -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Xbootclasspath/a:/home/oracle/xerces/xerces-2_9_0/xml-apis.jar -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"/>
                  </category>

After editing the opmn.xml manually, validate the opmn.xml with command:

$ORACLE_HOME/opmn/bin/opmnctl validate

Reload the changes in opmn with command

$ORACLE_HOME/opmn/bin/opmnctl reload

Update the dcm repository with command:

$ORACLE_HOME/dcm/bin/dcmctl updateconfig

3. Configure OC4J global-web-application.xml:

To avoid this exception:

OracleJSP: oracle.jsp.parse.JspParseException: /html/themes/brochure/templates/init.jsp: Line # 27, <theme:defineObjects />
Error: Tag attempted to define a bean which already exists: themeDisplay

Resolve: Add following in $ORACLE_HOME/j2ee/home/config/global-web-application.xml

<init-param>
  <param-name>req_time_introspection</param-name>
  <param-value>true</param-value>
</init-param>

4. Copy following jar files to $ORACLE_HOME/j2ee/home/applib

liferay-jdbc.jar
xercesImpl.jar
xml-apis.jar
xmlParserAPIs.jar

The link to Liferay's JDBC driver can be found from Liferay.com. Xerces parser can be downloaded from Apache.org site.

5. Bounce the OC4J container

6. Deploy Liferay EAR file using OracleAS Enterprise Manager.

Test and make sure everything works. If you have any additions, pls let me know and I'll update the notes here.

Looks like a new version of Liferay 4.x.x just popped out. You might give a shot and try above installation instructions with the latest release as well.

30.12.06

Windows Live Blog Client

Blogger.com got upgraded and my blogger client w.Bloggar refused to work properly with the new beta.blogger.com. Althought the newly announced beta -> production change, w.Bloggar didn't still work.

I started looking at alternatives and found Microsoft Windows Live Blog Client that seems to work nicely with the new Blogger.com.

As the new year 2007 is arriving I wish you all:

29.10.06

Configuring Jetty 6 to work with Oracle DB

I had the need to print out certain things from my OracleXE database + setup a Web Services engine. My Linux box was running only on 256MB of RAM so I needed a small servlet engine to acts as application server for my JSP application. There were two main options I considered:

  1. Tomcat

  2. Jetty



Tomcat



Started with Tomcat 5.5. Installed Tomcat. Installed Axis 1.4. For Axis I needed to manually install bunch of missing JARs. Tried a simple JSP page with JSLT and SQL tags to dig out information from OracleXE. Just to get into phase where I didn't get any missing class exceptions took me a while. I had to manually install mail.jar, activation.jar, xmlsec.jar etc. In the end of stripping out the exceptions I finally could connect the OracleXE database but the only problem was that none of the results were not displayed in the actual JSP result HTML (despite the connection to the database was working). Weird... I used quite a bit of time searching internet for answer how to get this working.

It was time to throw the towel to the ring. Farewell Tomcat.

Jetty



Downloaded Jetty 6.0.1. Installed it. Installed Axis 1.4. Axis installation was a nice surprise, almost all the needed libraries were already there for Axis 1.4. I only needed to add xmlsec jar file and Axis was happy. Axis installation was much more fluent in Jetty than in Tomcat. Tried my test JSP to connect OracleXE. There I faced some challeges but got over them very fast and was up and running with working JSP, using JSLT + SQL tags printing results out of my Oracle database.

Jetty was a pleasant surprise to me. For those folks that needs sample application that works with Oracle database using data sources, here are the steps to do it:

1. Create directory webapps-plus under $JETTY_HOME if that directory doesn't exists.
Jetty 6.0.1 is configured out-of-the-box with JNDI support if you deploy your application under webapps-plus directory. Also in order to get the JNDI support you need to start the Jetty engine with following parameters:

java -jar start.jar etc/jetty.xml etc/jetty-plus.xml



2. Create a sample application subdirectory $JETTY_HOME/webapps-plus/mysample.
3. Copy WEB-INF from $JETTY_HOME/webapps/test to $JETTY_HOME/webapps-plus/mysample
4. Copy Oracle JDBC driver to $JETTY_HOME/webapps-plus/mysample/WEB-INF/lib. I use ojdbc14.jar.
5. Edit the jetty-web.xml in $JETTY_HOME/webapps-plus/mysample/WEB-INF

You can configure the Oracle datasource in this config file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://j
etty.mortbay.org/configure.dtd">

<Configure class="org.mortbay.jetty.webapp.WebAppContext">

<Call class="org.mortbay.log.Log" name="debug">
<Arg>executing jetty-web.xml</Arg>
</Call>

<!-- Add a DataSource only valid for this webapp -->
<New id="oraclexe" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/oraclexe</Arg>
<Arg>
<New class="oracle.jdbc.pool.OracleDataSource">
<Set name="user">scott</Set>
<Set name="password">tiger</Set>
<Set name="URL">jdbc:oracle:thin:@myhostname.com:1521:XE</Set>
</New>
</Arg>
</New>
</Configure>


6. Create a sample JSP file that reports data from Oracle database using the data source defined in jetty-web.xml:

Here is the sample JSP with SQL tags:

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
<title>Oracle DB Test</title>
</head>
<body>

<h2>Results</h2>
<sql:query dataSource="jdbc/oraclexe" var="rs">
SELECT * FROM dual
</sql:query>

<c:choose>
<c:when test="${rs.rowCount == 0}">
Sorry, no messages found.
</c:when>
<c:when test="${rs.rowCount == null}">
Sorry, no messages found (null).
</c:when>
<c:otherwise>
Messages found (${rs.rowCount})
</c:otherwise>
</c:choose>

<c:forEach var="row" items="${rs.rows}">
Dummy ${row.dummy}<br/>
</c:forEach>

</body>
</html>


7. Bounce jetty to get all the changes in effect.

If everythings went well, you should be having a working connection to Oracle database printing out something like:
Results
Messages found (1) Dummy X

18.8.06

Disabling Gnome/KDE in RedHat startup

Here is something that I consider FAQ but never remember how to do it after installing RedHat Linux.
How to disable graphical desktop in server startup? This is to conserve system resourses when server is used only remotely e.g. SSH.

su -
vi /etc/inittab

Look for a line like this: id:5:initdefault:

This line specifies default runlevel on boot.
Default runlevel. The runlevels used by RHS are:
0 - halt (Do NOT set initdefault to this)
1 - Single user mode
2 - Multiuser, without NFS (The same as 3, if you do not have networking)
3 - Full multiuser mode
4 - unused
5 - X11
6 - reboot (Do NOT set initdefault to this)

Change the 5 in the quote above to a 3. Save and reboot.

27.3.06

HAM

BAM (Business Activity Monitoring) is cool new technology for business monitoring.
There are products like Oracle BAM

Home Activity Monitoring (HAM?) is a word I could describe following ultra COOL Dutch site: http://www.bwired.nl/
.

Amazing !! :)

22.2.06

OC4J (9.0.4, 10.1.2 and 10.1.3) log file rotation

For those that want to rotate the OC4J log files under $ORACLE_HOME/opmn/logs, there are new parameters not documented in 9.0.4/10.1.2 documentation:

[New JVM parameters]
"stdstream.filesize"
Max file size limit of each archive. Unit is megabyte.
"stdstream.filenumber"
Max number of files that oc4j can keep as archives. The oldest file
will be automatically deleted if the limit is exceeded.
"stdstream.rotatetime"
Time when the log file is rotated. Format is "HH:mm". The archive
will be rotated at the specified time everyday.

[Usage]
ex 1: rotate stdout/stderr when the file size is reached to 2.5M byte.
java -Dstdstream.filesize=2.5 -jar oc4j.jar -out std.out -err std.err
ex 2: rotate stdout at 13:30 everyday
java -Dstdstream.rotatetime=13:30 -jar oc4j.jar -out std.out
ex 3: rotate stdout at 13:30 everyday and keep 10 files as archive
java -Dstdstream.rotatetime=13:30 -Dstdstream.filenumber=10 -jar oc4j.jar -out std.out

The generated log file would look like <filename w/o extension>_yyyy_MM_dd_HH_mm_ss.<extension>
e.g. std_2004_07_08_13_24_53.out

[Note]
1. The same parameter are used for both "-out" and "-err".
2. In AS mode, the log files will be created under <island name and process id> directory
(this isn't changed by this fix, existing code handles this)
3. Both "filesize" and "rotatetime" parameters can be used at the same time.

opmn.xml
In order to get these parameters in opmn.xml you need to define it as follows:
...
<category id="start-parameters">
<data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Dstdstream.filesize=0.2 -Dstdstream.filenumber=5"/>
<data id="oc4j-options" value="-out std.out -err std.err"/>
</category>
...

You will find the new log files under:$ORACLE_HOME/j2ee/home/home_default_island_1

The file naming will be like:
std_2006_02_22_14_01_17.out
std_2006_02_22_14_16_25.out

15.1.06

HTML DB Region Title Dynamic Translation

I've been working at home to build our family web site using OracleXE and HTML DB (2.1). One of the targets for the new design is to support multiple languages dynamically so that whenever user has either English, Finnish or Swedish browser preference the web site should display using that language.


HTML DB has translation capabilities built-in but the functionality wasn't exactly what I was looking for. I wanted the same HTML DB application to support all above languages, not to have multiple languages and multiple applications.


Everything else was doable, I created dynamic content relational tables and the content of the web pages is retrieved from the database using the language preferred.


One problem are was region titles, which doesn't support translatability within the same application out of the box. I am able to print out the region title using application level attributes, so called substitution variables. This is half way what I wanted but there is no language perspective to this. I want to print out the welcome region box title as "Welcome", "Tervetuloa", "Välkommen" dependent on the browser language.


I finally discovered a way to do this. First of all I have to use javascript to do this. Secondly I thought I could use the "navigator.language" variable from the client browser to discover the preferred language of the browser, but this didn't work exactly as I thought. Namely this variable prints out the installed browser language, not the preferred language that user has selected from the browser preferences.


The workaround to discover how to get the "HTTP_ACCEPT_LANGUAGE" -setting took awhile. Finally I got a working Javascript snippet that did the trick with HTML DB:
<script type="text/javascript">var language = '&BROWSER_LANGUAGE.';
if (language.indexOf('fi') > -1) document.write("Tervetuloa");
else if (language.indexOf('sv') > -1) document.write("Välkommen");
else document.write("Welcome")</script>



So the key is to use the &BROWSER_LANGUAGE. -substitution variable to find out the preferred browser language to get the right result.