0

I'm creating data source using wsadmin(jython) script. My script ends with AdminConfig.save()

Following is sample script

parentIDs = AdminConfig.getid("/Node:"+nodeName+"/Server:"+serverName+"/JDBCProvider:"+jdbcProviderName+"/")
parentIDList = AdminUtilities.convertToList(parentIDs)      
parentID = parentIDList[0]
requiredAttrs = [["name", dataSourceName]]
otherAttrsList = [["jndiName", jndiName], ["description", description], ["authDataAlias", authAlias],["datasourceHelperClassname", 'com.ibm.websphere.rsadapter.GenericDataStoreHelper']]
otherAttrsList=AdminUtilities.convertParamStringToList(otherAttrsList)
newPS=[]
psAttr = [["propertySet", [["resourceProperties", newPS]]]]
finalAttrs = requiredAttrs+otherAttrsList+psAttr
dsExist = AdminConfig.getid("/Node:"+nodeName+"/Server:"+serverName+"/JDBCProvider:"+jdbcProviderName+"/DataSource:"+dataSourceName+"/")
if (len(dsExist) == 0):
    newds = AdminConfig.create("DataSource", parentID, finalAttrs)
AdminConfig.save()  

Scope of Mydata source is server

Data source gets created fine with above script, and I can see it on websphere console as well.(Also updated in resources.xml) But when the Websphere is restarted, I'm observing that resources.xml gets overwritten. It removes any data source that I've created from wsadmin script. Strange part is any data source created from console(on same scope) is retained in new resources.xml

Am I missing any additional command in my script? (Most of the scripts which I saw from IBM or net do not include any additional command after save, also scripting instructions for console do not include any new command)

Thanks

  • Are you using WAS ND (with deployment manager) or standalone server? – Gas Feb 27 '15 at 08:41
  • Hi Gas, I guess I'm using standalone server (single node, cell and server). Though I'm sure, is there any concrete way to find out that I'm not using WAS ND) – user3925269 Feb 27 '15 at 11:20
  • I've never seen such behavior in single server environment. If the `save()` is finished without any exceptions the change should be persistent. – Gas Feb 27 '15 at 14:07
  • Thanks Gas, that is what I thought (some scripts use sync, but since there is no NodeAgent enabled I don't think it is required in my case). Do you know if there is any property(or configuration) which recreates the resources.xml on server start. – user3925269 Feb 27 '15 at 14:20
  • There is no such thing as recreating on server restart. Especially it doesn't make sens, since update from console survives server restart :-). Make sure there are no parallel changes, or restoreConfig is not called, or you are not resetting profile via Eclipse. If it is repeatable, and appears always, you can open PMR. – Gas Feb 27 '15 at 17:22
  • Thanks Gas, there are no parallel changes since I'm the only person having credentials for it and also I'm not connecting it via eclipse. One last thing that comes to my mind is, may be the data source which I created from script is not adhering to xsd (or whatever format WAS expects it to be) and hence it is getting trimmed out from resources.xml. What are your thoughts on this? – user3925269 Feb 28 '15 at 05:22
  • Maybe try to create datasource using following examples http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.iseries.doc/ae/rxml_7adminjdbc.html?cp=SSAW57_8.5.5%2F2-18-3-13&lang=en – Gas Feb 28 '15 at 11:13

0 Answers0