Tips on using JDBC in GEL

Document ID : KB000027217
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

This article provides tips for using GEL tags.

Solution:

Use the <gel:setDataSource/> tag instead of the <sql:setDataSource/> tag.

The GEL version takes in a database id attribute as follows:

<gel:setDataSource dbId="Niku" [var="clarityDS"]/>

This tag will take the connection properties including the password from the CA System Application (CSA) properties. 'Niku' is the ID of the default internal Clarity database. In CSA you can modify this value and add as many external database definitions as you like, and also reference them like this. So if you add a second database connection definition in CSA called "ORA-FIN" you can reference those values with:

<gel:setDataSource dbId="ORA-FIN"/>

Note that the 'var' attribute is optional. If you do not specify a variable, it defaults and subsequent sql:query calls will use that default. In other words, you can do:

<gel:setDataSource dbId="Niku"/>

and

<sql:query var="result">
SELECT 1 from dual
</sql:query>

OR

<gel:setDataSource dbId="Niku" var="clarityDS"/>

and

<sql:query dataSource="${clarityDS}" var="result">
SELECT 1 from dual
</sql:query>

Another large benefit of using the <gel:setDataSource/> tag is that it enables connection pooling. This means connections will not be physically created with every query, as is the case with the <sql:setDataSource/> version.

Other Relevant Information:

Reference the latest Clarity Integration Guide for more information regarding the Clarity GEL functionality.