change data source properties in ibm websphere - websphere

I would like to update data source properties in IBM Websphere 8.5.5.0 using a script. Generally these properties are updated manually using admin console, but I would like to do it automatically. For this I need to know the .properties or .xml file or *.* in which data source configurations are stored.
Can anyone help me with this please.

If you already know how to update the configurations in the admin console, you could use the built-in command assistance to see what underlying wsadmin command was run by the update.
http://www.ibm.com/developerworks/websphere/library/techarticles/0812_rhodes/0812_rhodes.html
Generate a command using the console The first method is the most
basic use of command assistance. You launch the administrative
console, perform an action, and access the command assistance panel,
which displays the wsadmin command for that action.

DataSource configuration is stored in an xml file, but should not be edited directly by users.
If you want to use a script, use wsadmin to modify the properties you need.
See this doc for full information on modifying datasource properties using wsadmin:
Configuring new data source custom properties using wsadmin

Related

Configuring settings for last paricipant support wsadmin/websphere

Recently i've came to an issue to configure Last Participant Support on deployed application. I've found some old post about that:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014090728
On server itself i found how to do it. But with jython or wsadmin commands im not able to find how to do it on application itself.
But it does not help for me. Any ideas?
There is no command assistance available for the action of changing last participant support from the admin console which typically implies there is no scripting command associated the action. And there doesn't appear to be an wsadmin AdminApp command to modify the property. Looking at config repo changes made as a result of the admin console action, the IBM Programming Model Extensions (PME) deployment descriptor file "ibm-application-ext-pme.xmi" for an application is created/modified by the action.
If possible, the best long-term solution would be to use a tool like RAD to generate that extensions file when packaging the application because if you need to redeploy the app, your config changes wouldn't get overridden. If you can't mod the app, you can script the addition of an PME descriptor file in each of the desired apps with the knowledge that redeploying the app will overwrite your changes. The changes can be made by doing something along the lines of:
1) create a text file named ibm-application-ext-pme.xmi with contents similar to this:
<pmeext:PMEApplicationExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:pmeext="http://www.ibm.com/websphere/appserver/schemas/5.0/pmeext.xmi" xmi:id="PMEApplicationExtension_1559836881290">
<lastParticipantSupportExtension xmi:id="LastParticipantSupportExtension_1559836881292" acceptHeuristicHazard="false"/>
</pmeext:PMEApplicationExtension>
2) in wsadmin or your jython script do the following (note in this example the xmi file you created is in the current directory, if not, include the full path to it in the createDocument command) :
deployUri = "cells/<your_cell_name>/applications/<your_app_name>.ear/deployments/<your_app_name>/META-INF/ibm-application-ext-pme.xmi"
AdminConfig.createDocument(deployUri, "ibm-application-ext-pme.xmi")
AdminConfig.save()
3) restart the server

Fetch JMS configurations and property values for each individual servers in WAS using wsadmin script

I need to fetch JMS configurations and property values for each individual servers of WAS using wsadmin script. Is there any IBM standard jython or jacl script is there to fetch these values ? If not, can somebody guide me how to procceed.
You can export your server configuration via wsadmin command (this will export all server configuration):
AdminTask.extractConfigProperties('[-propertiesFileName ConfigProperties_server1.props -configData Server=server1]')
To extract properties related to MQ JMS resources you could provide subtype in the script:
AdminTask.extractConfigProperties('[-propertiesFileName mq.props -configData Server=server1 -filterMechanism SELECTED_SUBTYPES -selectedSubTypes [MQConnectionFactory MQQueue]]')
You could modify required properties and then import them to different server/environment.
See more details about different types and usage here Extracting properties files using wsadmin scripting.
AdminTask and AdminConfig are good tools for this.
You can use the jython line "print AdminTask.help('-commands')" to print all the commands that your configuration supports.
As for AdminConfig you will need a bit of knowledge on how was xml configurations are stored.
See for more info: http://www-01.ibm.com/support/knowledgecenter/?lang=en

Can I dynamically update the websphere 's log configuration in my own code?

In websphere admin console, we can change the log configuration , for example, the log file name, rolloverSize and log level and so on. After we saved the change in console, if we choose run time and chose write the file to xml. In this case, the log configuraiton change will be write to config file (such as: \config\cells\SENLI-XPNode01Cell\nodes\SENLI-XPNode01\servers\server1\server.xml)
You know websphere support the dynamically change the log configuraiton, after we changed it, it will take effect immidiately.
My quesiton is that in my own code, is there any websphere public api we can invoke to implement the dynamically change the log configuraiton?
You use the AdminClient to look up the TraceService MBean and update the trace string via that interface.
To modify the values saved in xml you can use the ConfigService to programmatically. I'll warn you that this approach isn't for the faint of heart.

Out of the box approach to upload XML file to the BIRT Server for Processing

I have the BIRT Report Server configured in TOMCAT and it works fine when running reports that require an XML datasource, but that XML file has be available on the network in order for the server to find it and run. Is there an out of the box configuration in the BIRT server that will prompt the user to upload the XML file directly to the server when they try to run a given report that requires an XML data source? This would be handy for users that have the XML datasource stored locally on their C drive and not have to move them to a network server in order to be read by BIRT. Thanks in advance.
Paul
There is not an OOTB solution that does what you describe.
Without the OOTB option, the best way to handle this would be using Actuate's IDAPI. This will give you all the tools to get the file uploaded and added to the iServer. You can expose the IDAPI interface in any number of ways including on the BIRT report itself or on a custom parameter request page.

WAS7 System Properties in RAD 7.5.1

I have an old project in WSAD 5.1.2 with a WAS4 server configuration that's in a .wsi-file. If I double click it I get the server configuration editor and on the environment tab there is a System Properties section with some name-value pairs.
Now I have opened the same project in RAD 7.5.1. Where can i input the same name-value pairs for a server in RAD 7.5.1? There's no "environment-tab" if I double-click my server, just an "Overview" tab.
I finally found the proper way of doing it in the admin web interface...
Application servers > myServer > Process definition > Java Virtual Machine > Custom properties
In RAD 7.5.4 JVM name value pair is stored in Servers --> Application Servers --> java and process Management --> process definition --> java virtual machine --> custom properties
here you can create a new name value pair which can be used by Java code using System get properties function.
Apparently IBM started to ship a real application server starting with RAD/RSA6 instead of the test server that comes with WSAD. So to configure the appserver it's just to use the web admin interface as usual.
Thanks to Jeanne Boyarsky for the answer in the forums over at The Java Ranch.
The old app I'm porting needs some properties in the system properties of the JVM set so that they can be retrieved with System.getProperty(...) and I found a dirty way of making it work. So, until I find out how to do it the proper way, if there is a proper way, I came up with this hack:
After doing some "find" and "grep" in the profile directory of the appserver i found a file called:
runtimes\base_v7\profiles\<profilename>\config\cells\<cellname>\nodes\<nodename>\servers\<servername>\server.xml
At the bottom of server.xml there is a <jvmEntries xmi:id="JavaVirtualMachine_.... tag.
Inside it you can add system properties tags on the format:
<systemProperties xmi:id="someId" name="name of your property" value="the value" required="false"/>
Anyone who knows how to to this the proper way and has read all the way down here must be crying by now... :)
But, it seams to work...

Resources