Please use the google group to ask questions - thanks.

by vannevar 20 Feb 06:41

I have to backup the H2 database from the application using it. AFAIK the database connection should be closed before executing that command. So disconnect-backup-reconnect is the work flow. At restore it's more complicated as before reconnecting at least the whole data cache should be erased.

Are these functions possible with Ebean now, and if so, how?

I tried the brute-force solution (shutdown and creating a new connection) but I couldn't erase the DataSourcePool slot from DataSourceManager and thus couldn't renew the connection under the same name.

21 Feb 08:29
by Rob

So if you are using Ebean's DataSourcePool as the DataSource implementation (sounds like you are) then...

DataSourcePool.reset() will remove and close completely all the 'free' connections in the pool. If you have no busy connections that will effectively remove all connections from the pool.

You can possibly also make use of createUnpooledConnection().

If you start using the pool after it was reset() ... then it will create new connections for the pool etc automatically.

By "couldn't renew the connection under the same name." ... I think you probably meant couldn't renew the 'Connection Pool'? ... but I think reset() is probably more what you need.

Cheers, Rob.

21 Feb 22:51
by vannevar

Indeed, DataSourcePool.reset() is the function I needed. :) I suppose I did not look close enough. Thank you!

Create a New Topic

Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements