Edmund Castermund wrote:...is that a standard thing; try to connect to a db, and connect to another source if it times out? Is it bad design?
It is not standard, but as per your requirements. Lots of applications fail when their database is not available.
It is not bad design. You require it. Your proposal to connect to the second source if connecting to the first one fails is ok.
However, if you are going to call getConnection each time you want to write something, that will be:
- a performance issue: you will hit the timeout every time
- a data consistency issue: you have saved a part to XML, then you plug in your network cable. Next data storage will happen to the database, because getConnection succeeds.
Isn't it better to check and select source once at program start, and continue using the data source until program ends?