@Override
public void forcePasswordUpdate(String password) throws ApplicationException {
// we know it's ComboPooledDataSource, as we define it in applicationContext.xml
// this is the primary reason for using C3P0 rather than Apache DBCP, since it
// doesn't support password updates.
ComboPooledDataSource dataSource = getDataSource();
ComboPooledDataSource initialDataSource =
(ComboPooledDataSource) initialJdbcTemplate.getDataSource();
dataSource.setPassword(password);
initialDataSource.setPassword(password);
try {
dataSource.softResetDefaultUser();
initialDataSource.softResetDefaultUser();
} catch (SQLException e) {
throw new ApplicationException("Password update failed!", e);
}
try {
initialJdbcTemplate.execute("select 1");