Jython : How to set/modify the URL of a Datasource??? - HELP! - Websphere

This is a discussion on Jython : How to set/modify the URL of a Datasource??? - HELP! - Websphere ; Hi, i have a problem on my Was 6.1: with a jython script i can create a datasource using: +...+ +...+ +AdminConfig.createUsingTemplate("DataSource", provider, attrs, Dtemplate)+ +...+ +...+ after this i can change the datasource helper, the auth. data (and other ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Jython : How to set/modify the URL of a Datasource??? - HELP!

  1. Jython : How to set/modify the URL of a Datasource??? - HELP!

    Hi,
    i have a problem on my Was 6.1: with a jython script i can create a datasource using:

    +...+
    +...+
    +AdminConfig.createUsingTemplate("DataSource", provider, attrs, Dtemplate)+
    +...+
    +...+

    after this i can change the datasource helper, the auth. data (and other things) with:

    +...+
    +...+
    +Helper = ["datasourceHelperClassname", "com.ibm.websphere.rsadapter.Oracle10gDataStoreHelp er"]+
    +JCA = [ "authDataAlias" , "TEST" ]+
    +attrs = []+
    +attrs.append(Helper)+
    +attrs.append(JCA)+
    +AdminConfig.modify(ds1, attrs) ##ds1 is the datasource created before+
    +...+
    +...+

    But if i want to set the database URL or another J2EEResourceProperty, i can't.

    So: How can i change/set the URL of a database in a Jython (or Jacl) script?

    Thanks in advance!
    Alessandro

  2. Re: Jython : How to set/modify the URL of a Datasource??? - HELP!

    ---update--

    The error is:

    exception information:
    com.ibm.ws.scripting.ScriptingException: WASX7080E: Invalid attributes specified for type "J2EEResourcePropertySet" -- "URL"

  3. Re: Jython : How to set/modify the URL of a Datasource??? - HELP!

    I think something goes wrong with the brackets in my original post:

    The two parameters were:

    Helper = "datasourceHelperClassname", "com.ibm.websphere.rsadapter.Oracle10gDataStoreHelp er"
    JCA = "authDataAlias" , "test"

    but with [] brackets...

    :-)

  4. Re: Jython : How to set/modify the URL of a Datasource??? - HELP!

    You need to modify the modify theJ2EEResourcePropertySet associated with the data source , following is an example for jython

    datasourceHelperClassname = "com.ibm.websphere.rsadapter.DB2UniversalDataStoreH elper" #replace by helper class
    dbnameAttr = [["name", "databaseName"], ["value", "databaseName"], ["type", "java.lang.String"]]
    dbserverName = [["name", "serverName"], ["value", "servername"], ["type", "java.lang.String"]]
    dbseverTypeAttr = [["name", "driverType"], ["value", "type"], ["type", "java.lang.String"]]
    dbserverPort = [["name", "portNumber"], ["value", "portNumber"], ["type", "java.lang.String"]]
    newsprops = []
    newsprops.append(dbnameAttr)
    newsprops.append(dbserverName)
    newsprops.append(dbseverTypeAttr)
    newsprops.append(dbserverPort)
    psAttr = ["propertySet", [["resourceProperties", newsprops]]]
    resourceAttrs = [psAttr]
    AdminConfig.modify(ds,resourceAttrs) # where ds is your datasource

  5. Re: Jython : How to set/modify the URL of a Datasource??? - HELP!

    Attaching the sample file. There seems to be a issue with respect to [] when posting the msssage.

  6. Re: Jython : How to set/modify the URL of a Datasource??? - HELP!

    Hi, your code maybe works with Db2 Datasources, but with Oracle URL doesn't.

    But i solved with the code i'v attached!!

    Thank you anyway
    Alessandro

  7. Re: Jython : How to set/modify the URL of a Datasource??? - HELP!

    Yep , for Oracle you need to specify URL property , each datasoure has different properties.

+ Reply to Thread