This content has been marked as final. Show 2 replies
datasource.reset() should do the trick.1 person found this helpful
From the documentation (http://docs.oracle.com/cd/E12839_01/apirefs.1111/e13951/mbeans/JDBCDataSourceRuntimeMBean.html)
"Resets the connection pool in the data source by shutting down and recreating all available database connections in the pool.
Use when a data source is in the health state of Unhealthy and needs to be reinitialized."
But I think it just re-uses what is in memory (the mbean settings I mean).
As you mentioned "The Admin Console tells me that this requires me to restart the changed JDBCResource, and allows me to do so in the View Changes and Restarts page"
when you perform this in the console, does it actually connect to the other database (seen a number of occasions where that was not happening and had the restart the
You can use the ServerLifeCycleRuntimeMBean (http://docs.oracle.com/cd/E12839_01/apirefs.1111/e13951/mbeans/ServerLifeCycleRuntimeMBean.html) to start and stop servers,
an example is provided here http://middlewaremagic.com/weblogic/?p=8187 (see the 'Using Server Life Cycle Runtimes' section).
Thanks, you got me on the right track with the ServerLifeCycleRuntimeMBean, although mainly because it's accessed from the DomainRuntimeMBean, and the solution is there (http://docs.oracle.com/cd/E12839_01/apirefs.1111/e13951/mbeans/DomainRuntimeMBean.html). There's a restartSystemResource() operation in the DomainRuntimeMBean, which does what I need it to do:
Doing this disconnects the old database connections, and creates a new connection to the newly configured database.
for jdbcSr in domainRuntimeService.getDomainConfiguration().getJDBCSystemResources(): domainRuntimeService.getDomainRuntime().restartSystemResource(jdbcSr)