Topic
  • 2 replies
  • Latest Post - ‏2012-11-19T14:25:00Z by SystemAdmin
SystemAdmin
SystemAdmin
37422 Posts

Pinned topic How can I tick the "Non-transactional data source" check box using Jython?

‏2012-11-16T14:17:01Z |
Dear Forum,

How can I tick the "Non-transactional data source" check box using Jython?

If I've understood correctly I've to get the ResourceEnvironmentProvider and update the nonTransactionalDataSource in the J2EEResourcePropertySet.

But my main problem is to obtain the correct ResourceEnvironmentProvider from my Datasource, any Ideas how to do this?

Best Regards,

Romeo


Romeo Kienzler
Data Scientist and Architect
M. Sc. (ETH) in Information Systems, Statistics and Bioinformatics
Technology Consultant, IBM Innovation Center
r o m e o . k i e n z l e r( a - t ) c h . i b m . c o m
Updated on 2012-11-19T14:25:00Z at 2012-11-19T14:25:00Z by SystemAdmin
  • bpaskin
    bpaskin
    4675 Posts

    Re: How can I tick the "Non-transactional data source" check box using Jython?

    ‏2012-11-16T19:56:02Z  
    Hi,

    Try this:

    attrs = '[[name "nonTransactionalDataSource"] [type "java.lang.Boolean"] [value "true"] [required "false"]]'
    datasource = AdminConfig.getid("/DataSource:YourDataSource/")
    propertySet = AdminConfig.showAttribute(datasource,"propertySet")
    propertyList = AdminConfig.list("J2EEResourceProperty", propertySet).splitlines()
    for property in propertyList:
       if (AdminConfig.showAttribute(property, "name") == "nonTransactionalDataSource"):
             AdminConfig.modify(property, attrs)
    


    Regards,
    Brian
    Updated on 2014-03-25T23:51:49Z at 2014-03-25T23:51:49Z by iron-man
  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: How can I tick the "Non-transactional data source" check box using Jython?

    ‏2012-11-19T14:25:00Z  
    • bpaskin
    • ‏2012-11-16T19:56:02Z
    Hi,

    Try this:

    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">attrs = '[[name "nonTransactionalDataSource"] [type "java.lang.Boolean"] [value "true"] [required "false"]]' datasource = AdminConfig.getid("/DataSource:YourDataSource/") propertySet = AdminConfig.showAttribute(datasource,"propertySet") propertyList = AdminConfig.list("J2EEResourceProperty", propertySet).splitlines() for property in propertyList: if (AdminConfig.showAttribute(property, "name") == "nonTransactionalDataSource"): AdminConfig.modify(property, attrs) </pre>

    Regards,
    Brian
    Dear Brian,

    thanks a lot, this works just fine!

    Best Regards,

    Romeo