28 March 2015

Moved Forms PJC examples to GitHub

I moved my Forms PJC examples to GitHub. The examples and the Oracle JDeveloper projects can now be found at: https://github.com/mark-oradev/FormsPJC

19 March 2015

Update a grails project from version 2.3.8 to version 2.4.4

At first I changed the version of the application to 2.4.4.
> grails set-grails-version 2.4.4

I also created a new appliction with grails 2.4.4. From this application I took the BuildConfig.groovy and copied the content into to the BuildConfig.groovy of the application I wanted to update. Then I added the changes to the BuildConfig which  are necessary for the application.

In the datasource of the application I had to change my current setting for hibernate which pointed default to Hibernate 3 so it will point to hibernate 4.
So I commented:    
//cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
And uncommented:
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
    
I copied the applicationContext.xml from the web-app/WEB-INF folder of the new application to the same file of the application I wanted to update. 

Then I removed the target folder and tried to run the application by running
> grails run-app.

For one of my applications I got an error after starting. I fixed that application by setting the Hibernate version back from Hibernate 4 to Hibernate 3. 

24 February 2015

Created the first version of the JavaFX Browser inside Oracle Forms

I created the first version of the JavaFX browser inside Oracle Forms.

It still needs some adjustments, but the first version can be found at https://sites.google.com/site/oraont/jxbrowser-bean


I created a Form with two java beans components. I added the JavaFX browser with a socket server to one component and I added a socket client to the other component. With the socket server I made it possible to communicate to the java browser.


18 February 2015

Playing around with JavaFx inside Oracle Forms

Sometime ago someone asked me some questions about the Enhanced java bean. That java bean was based on the JDIC (java desktop integration component) of sun. The project of  jdic hasn't been updated for quite some time. So the java bean is getting harder to use.

So I was searching for a different solution, when I stumbled on JavaFX. I now have the following results:


This a JavaFX browser inside Oracle Forms. It now displays a hard code webpage (google.nl) but inside the search window I could easily navigate to oracle.com. So the component still needs some enhancement before it will be available.

The difference between this component and the enhanced html browser is that this component only displays html content. So you can't open a PDF document with this solution.

Another component I tried was the PieChart
This component shows a hard coded piechart. I tried this hardcoded first just to see if it was possible. I now will have to change it, so arguments can passed to it.

Note! Since JavaFX is available in jre 7 it will not be available for the older Oracle Forms components/ I've been testing with Oracle Forms 11gR2  and a java runtime 1.7, In older versions you will get an error message that the components used are from a newer version.


25 January 2015

Grails on Openshift

I created a simple Grails application which makes it possible to store client data inside a MySQL database. I created this application since I want to learn more about GORM (Grails Object Relational Mapping).

I already tested the application in the internal server from Grails, but I wanted to deploy it to a remote server. So I created a development account on Openshift and there I created the following server:

  • Tomcat 7 (JBoss EWS 2.0)
  • MySQL 5.5
  • phpMyAdmin 4.0
The phpMyAdmin cartidge is not necessary for installing the Grails application on the server. But it is ideal for checking the data inside the MySQL database.

I created a new war-file for the grails application and deployed it to the Openshift server.

When creating the Openshift server I got a url for the MySQL database. But when I placed this URL inside the datasource the application did not work. I found an ip-address inside the phpMyAdmin and when I used that ip number inside the datasource at first it worked fine. But I discovered that the ip-address was changing so I had to find another way to connect to the MySQL database.

After searching the internet I found the following entries for the datasource.

def credentials = [
    hostname:System.getenv("OPENSHIFT_MYSQL_DB_HOST"),
    port:System.getenv("OPENSHIFT_MYSQL_DB_PORT"),
    username:System.getenv("OPENSHIFT_MYSQL_DB_USERNAME"),
    password:System.getenv("OPENSHIFT_MYSQL_DB_PASSWORD"),
    name:"KLANT"
]

dataSource {
    dbCreate = "create-drop"
    driverClassName = "com.mysql.jdbc.Driver"
    url = "jdbc:mysql://${credentials.hostname}:${credentials.port}/${credentials.name}?useUnicode=yes&characterEncoding=UTF-8"
    username = credentials.username
    password = credentials.password
    pooled = true
}


25 November 2014

PL/SQL Webservice deployment with Apache Ant on Weblogic

I created a PL/SQL Webservice using Oracle JDeveloper. I want to use the same generated source tree for development and testing. 

Deploy/Undeploy/Redeploy
To deploy the webservice to the weblogic applications server I found some Ant deployment examples. 

<target name="deploy">
<wldeploy action="deploy" adminurl="t3://${wls.hostname}:${wls.port}" failonerror="false" name="${deploy.name}" password="${wls.password}" source="${deploy.folder}/${deploy.name}${buildnr}.war" targets="${deploy.target}" user="${wls.username}" verbose="true"/>
</target>
<target name="redeploy">
<wldeploy action="redeploy" adminurl="t3://${wls.hostname}:${wls.port}" failonerror="false" name="${deploy.name}" password="${wls.password}" targets="${deploy.target}" user="${wls.username}" verbose="true"/>
</target>
<target name="undeploy">
<wldeploy action="undeploy" adminurl="t3://${wls.hostname}:${wls.port}" failonerror="false" name="${deploy.name}" password="${wls.password}" targets="${deploy.target}" user="${wls.username}" verbose="true"/>

</target>

I've written some java code to parse the the webservice files to change the datasource inside the javacode. It looks something like "java:comp/env/jdbc/devDS" where devDS is the datasource to the development scheme inside the database. The parser changed it in somehting like "java:comp/env/jdbc/testDS" where testDS is the datasource pointing to the testing environment. The parser also changes entries inside the web.xml so it points to the correct datasource as well. 
It also changes the entry for the webservice-contextpath so I can have the webservice deployed on the same weblogic server. 

After changing the java classes and the xml files I added some entries to the ANT file to make it possible to create a war file.
<target depends="init" name="compile">
<javac debug="true" destdir="classes" executable="${javac.exe}" fork="yes" srcdir="src">
<classpath refid="compile.classpath"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>

</target>
<target depends="compile" name="war">
<war destfile="${deploy.source}" webxml="public_html/WEB-INF/web.xml">
<fileset dir="public_html"/>
<classes dir="classes/"/>
</war>
</target>
I also added a executable and a fork to the javac tag so I can run this from another ANT build file.

I created a default target which does a undeploy, compile, war and then deploy the war to the application server.
<target depends="undeploy,compile,war,deploy" name="all"/>