I'm wondering if there's anyway of suspending / returning to weblogic 10 jdbc datasources through the command line. I know will be able to do that within the admin console, but because our application has numerous different datasources it's a little of the discomfort.

The explanation for this really is our testers do error flow tests and also have to simulate the db heading down. Ideally i must give a softball bat apply for suspending all datasources and the other one for returning to all datasources.

Any ideas?


You should use the WLST scripting to achieve that. In the command line, run $BEA_HOME/wlserver10./common/bin/wlst.sh (.cmd on Home windows): Connect with the running server. Make use of the handled server port because this is a server runtime property:

wls:/offline> connect('weblogic','weblogic','t3://localhost:7002')

Visit the serverRuntime tree: wls:/mydomain/serverConfig> serverRuntime()

Visit the JDBCService, for your handled server title, the JDBCDataSource Runtime and lastly for your datasource title:

wls:/mydomain/serverRuntime> cd('JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS')

Then just suspend and resume it:

wls:/mydomain/serverRuntime/JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS> cmo.suspend()
wls:/mydomain/serverRuntime/JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS> cmo.resume()

use command ls() to determine the another variables and procedures.

You are able to record your script... may be simpler than writing the batch file in some instances.

You will get assist with the techniques via javadocs.