The Java code sample given below is used to edit the Data Sources in a Data Source Application deployed on SAP WAS J2EE Engine. Refer my earlier blogs on Data Source to find how JDBCDescriptor and DataSourceManager are created. Also find the pre-requisites for creating the application in the same blog.
Update Data Source Application:
The user has to prepare the JDBCDescriptors for the particular application to be updated and add them to a Vector. Then the updateDataSourceApplication is called upon by passing the application name and the vector is passed to the method. The user also can give the option to start the data source application. Set the value to true if the application has to be re-started. When the user updates the application the old application is removed and a new one is created.
1. When the user creates a Data Source application there should be atleast one data source created.
2. When the user wants to add data sources, the JDBCDescriptor of the all the previous created data sources should be made available along with the new one or the new one will replace all the data sources that were initially created on SAP WAS in the particular Data Source Application.