Using JNDI Connections with Extlib JDBC Extensions

Monday, August 25, 2014 at 6:31 PM UTC

In my last post I dabbled around with the latest JDBC enhancements of the Extension Library from OpenNTF/IBM (http://mardou.dyndns.org/hp.nsf/blogpost.xsp?documentId=C1A) using the @Functions in SSJS. After having a closer look to the sources of the Extension Library I found a way how to do it using pure Java and the default SQL classes Lächelnd

In this post I want to show you the entry point to the usage of these features using pure Java. In this scenario I am using a simple Java class to open the connection via JNDI that is defined with the .jdbc file in the post above to get a simple SQL result set. After getting the resultset (hopefully) this sample fills an ArrayList of HashMaps containing the column values of each dataset.

Each list entry (the dataset) is consumed by a repeat control on an XPage to display my data.

This is a very convenient way to access your relational data with a backend Java class (or a bean maybe...).

Here is the code of the Java class:

I am using this class in my XPage defined with the following code:

You can find this working sample live here: http://mardou.dyndns.org/postgres.nsf/jndi.xsp







Leave a comment right here