Hi Alex,

here what i'd do:

1) add to my DB config Flushable = true
2) prevent any input to the instance (a load balancer is a smooth way to do
so)
3) have a way to flush it (JMX, JAXRS, @Scheduled...). Impl would inject
the datasources then cast them in Flushable (java.io IIRC) and just call
flush method (Flushable.class.cast(injectedDs.flush()).
4) flush it on DB side
5) add back the instance as active to the load balancer

If the DB is shared you need to ensure the app can work loosing connections
for a small amount of time (read only DB, extreme caching etc are options)



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-07-16 11:22 GMT+02:00 Alex Soto <[email protected]>:

> Hi guys,
>
> I have one question which I think it is something related to database pool
> and not TomEE itself, but let me explain it.
>
> I want to force to reconnect all jdbc connections every X time. To simplify
> I want to add an expiration time to all jdbc connections (in case they are
> pooled) regardless if it is being used or not.
> I need this because my security team needs that database password change
> every X hours, so I can do it in the database side without much problem but
> what's happening to JPA side?
>
> Do you have any idea on how I can do this in a safe way?
>
> Thank you so much,
> Alex
>

Reply via email to