Steps to Automate the Upgrade of Database Drivers for TRA based SF Component Types using Ant Tasks or REST Services API

Steps to Automate the Upgrade of Database Drivers for TRA based SF Component Types using Ant Tasks or REST Services API

book

Article ID: KB0085100

calendar_today

Updated On:

Products Versions
TIBCO Administrator - Enterprise Edition Distribution for TIBCO Silver Fabric -
Not Applicable -

Description

Description:
During infrastructure upgrade the customers could find themselves in a position that they would need to make available a new database driver file to existing Silver Fabric components. Although this operation is very simple and straightforward from Admin UI, in case of a large number of components there would be the need to use programmatic solutions in order to speed up the whole process.

Resolution

The database driver upgrade process consists basically in three steps to be done:

1. Upload the new driver file into the component. At the end of this step the new driver file will be visible in component's menu "Add/override/customize Container and Component-specific content files".
2. Change the file referenced by runtime variable JDBC_DRIVER_FILE to the newly uploaded file. At the end of this step the entry "Upload a JDBC driver for this Database" which can be found under "TIBCO Administrator Database Configuration" will point to the new driver file.
3. Publish the changes. Eventually the changes will be saved so the component will need a restart afterwards.

Using Ant tasks:
-------------------------

1. In case Ant tasks are being used the step 1 can be achieved by using "sf:content-file" element including a "sf:contentset".

Example:
       <target name="deploy-files">
<sf:content-file type="component" name="${component.name}" action="add">
                     <sf:contentset dir="${content.dir}">
                          <include name="**/jdbc/ojdbc7.jar" />
                     </sf:contentset>
                </sf:content-file>
        </target>

where
- {component.name} is the nave given to the component by the user.
- {content.dir} is the root path for the component structure.


2. This step can be achieved by using the element "sf:context-variable" including "sf:contextvar".

Example:
<target name="set-path" depends="deploy-files">
<sf:context-variable type="component" name="${component.name}" action="update">
<sf:contextvar name="JDBC_DRIVER_FILE" type="environment" value="${contextvar.jdbc.driver.file}" export="true" autoincrement="none" description="null" />
</sf:context-variable>
        </target>

where
- {contextvar.jdbc.driver.file} is the relative path to the driver file from the component's root directory.


3. Component can be published with "sf:publish".

Example:
<target name="publish-changes" depends="set-path">
<sf:publish type="component" name="${component.name}" />
</target>

For a full example please refer to build.xml attached.


Using REST services:
--------------------------------

1. This step can be achieved by calling the service "POST components/{component-name}/content-files"

Example:
curl -u {USERNAME}:{PASSWORD} -X POST 
-H "Accept:application/json" 
-H "Content-Type: multipart/form-data" 
-F "relativePath=jdbc/" 
-F "contentFile=@ojdbc7.jar" 
-v "http://{HOSTNAME}:{PORT}/livecluster/rest/v1/sf/components/{COMPONENT_NAME}/content-files"

where 
- "relativePath" is the relative path to the driver file from the component's root directory.
- "contentFile" is the file name for the new driver


2. This step can be achieved by calling the service "PUT components/{component-name}/runtime-variables/{variable-name}"

Example:
curl -u {USERNAME}:{PASSWORD} -X PUT 
-H "Content-Type:application/json" 
-d '{ "name": "JDBC_DRIVER_FILE", "value": "jdbc/ojdbc7.jar", "type": 1, "description": "null", "export": true, "autoIncrementType": 0 }' 
-v "http://{HOSTNAME}:{PORT}/livecluster/rest/v1/sf/components/{COMPONENT_NAME}/runtime-variables/JDBC_DRIVER_FILE"


3. This step can be achieved by calling the service "PUT components/{component-name}/published/true"

Example:
curl -u {USERNAME}:{PASSWORD} -X PUT 
"http://{HOSTNAME}:{PORT}/livecluster/rest/v1/sf/components/{COMPONENT_NAME}/published/true"

Issue/Introduction

Steps to Automate the Upgrade of Database Drivers for TRA based SF Component Types using Ant Tasks or REST Services API

Additional Information

Silver Fabric Developer's Guide 5.7.0

Attachments

Steps to Automate the Upgrade of Database Drivers for TRA based SF Component Types using Ant Tasks or REST Services API get_app