Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help in fetching connectionTimeout value for datasources, using jython scripting

 
Avijit Pal
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#-------------------------------------------------------------------------------
import sys
global AdminConfig
global AdminControl
lineSeparator = java.lang.System.getProperty('line.separator')

#-------------------------------------------------------------------------------
# updateDataSource(scope,params)
# update connection timeout value for all datasources
#-------------------------------------------------------------------------------

def updateDataSource(scope,params):
dataSources = AdminConfig.list('DataSource', AdminConfig.getid(scope))
if len(dataSources) > 0:
dsList = dataSources.split(lineSeparator)
for ds in dsList:
dsName = AdminConfig.showAttribute(ds, "name")
if dsName != "DefaultEJBTimerDataSource":
print AdminConfig.showall(ds) ####### It shows everything, but I only need connectionTimeout value
AdminConfig.modify(ds, params)
print " Modified datasource: " + dsName

#endDef
#-----------------------------------------------------------------




OUTPUT for AdminConfig.showall():

[authMechanismPreference BASIC_PASSWORD]
[category default]
[connectionPool [[agedTimeout []]
[connectionTimeout 1000]
[maxConnections 30]
[minConnections 1]
[purgePolicy FailingConnectionOnly]
[reapTime 180]
[unusedTimeout 1800]]]
...........................
....................
.............
.......
..




Hi friends,

I have developed the above script to modify connectionTimeout value for all datasources in a specified scope. Before modifying the values I want the script to fetch and show current values for backout purpose, but facing issues in fetching connectionTimeout value. AdminConfig.showall() can fetch everything but I want only value for connectionTimeout which is 1000 here. Can anyone give me a quick solution as this is very urgent for me. Thanks in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic