How to use the updateDatasource API to modify parameters of a datasource?
book
Article ID: KB0072742
calendar_today
Updated On:
TIBCO Data Virtualization
8.4
Show More
Show Less
Description
An example containing the various details that are required in order to successfully use the updateDatasource API.
Issue/Introduction
This article explains how to use the updateDatasource API to modify parameters of a datasource.
Resolution
1. Invoked the getDataSourceTypes api to find the resource name for the datasource that needs to be used e.g. : mySQL. Below is the XML used: --------------------------------------------------------------------------------------------------------------------------------------------------- <resource:getDataSourceTypes xmlns:resource="http://www.compositesw.com/services/system/admin/resource" xmlns:common="http://www.compositesw.com/services/system/util/common"> <resource:detail>SIMPLE</resource:detail> </resource:getDataSourceTypes> --------------------------------------------------------------------------------------------------------------------------------------------------- 2. Check the resource name of the DB which in this example is "MySQL 5.5". Invoke the getDatasourceAttributeDefs api to find the correct datasource parameter and the data type that needs to be passed in order to change its value in the updateDataasource api: Excerpt from the response XML: --------------------------------------------------------------------------------------------------------------------------------------------------- <resource:getDataSourceAttributeDefsResponse xmlns:resource="http://www.compositesw.com/services/system/admin/resource" xmlns:common="http://www.compositesw.com/services/system/util/common"> <resource:attributeDefs> <common:attributeDef> <common:name>advancedTab</common:name> <common:type>NULL</common:type> <common:updateRule>READ_ONLY</common:updateRule> <common:annotation>Advanced Settings</common:annotation> <common:displayName>Advanced</common:displayName> <common:parentName>mainTabGroup</common:parentName> <common:visible>true</common:visible> <common:editorHint>TAB</common:editorHint> </common:attributeDef> .. .. <common:attributeDef> <common:name>urlPort</common:name> <common:type>INTEGER</common:type> <common:updateRule>READ_WRITE</common:updateRule> <common:required>false</common:required> <common:defaultValue>3306</common:defaultValue> <common:displayName>Port</common:displayName> <common:visible>true</common:visible> <common:editorHint>TEXT</common:editorHint> </common:attributeDef> </resource:attributeDefs> </resource:getDataSourceAttributeDefsResponse> --------------------------------------------------------------------------------------------------------------------------------------------------- 3. Use the Common name as "urlPort"(case-sensitive field) and the common type as "INTEGER" in the updateDatasource API to update the required data: <resource:updateDataSource xmlns:resource="http://www.compositesw.com/services/system/admin/resource" xmlns:common="http://www.compositesw.com/services/system/util/common"> <resource:path>/shared/mysql</resource:path> <resource:detail>FULL</resource:detail> <resource:annotation>?</resource:annotation> <resource:attributes> <common:attribute> <common:name>urlPort</common:name> <common:type>INTEGER</common:type> <common:value>0000</common:value> </common:attribute> </resource:attributes> </resource:updateDataSource> After this, the data gets updated successfully.
Feedback
thumb_up
Yes
thumb_down
No