• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

How can I secure the database to make it robust?  RSS feed

Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made several calls to JDBC which spread over a couple of modules.
I wonder, if say the power breaks down, the database will
be in a inconsistent state, How can I ensure this won't happen,
Do I delay the commit to the very last minute?
Posts: 3752
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The databases (except perhaps the most simple ones, such as MS Access) are designed to protect the data even in case of system failure or power outage. If this happens, the database does what is necessary to get into consistent state after next startup. Everything what was committed is guaranteed to be there, and everything what wasn't committed gets cleaned up.

More advanced databases can usually be even configured to provide protection agains media failure, situation where your hard disk fails. This usually requires some more configuration and doesn't work out of the box automatically. If you were interested into this kind of protection, your best bet would be to consult your database documentation.
Posts: 23714
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And as a general rule you should commit your transactions as soon as possible, rather than delaying the commit as long as possible. Uncommitted transactions may lead to problems with other applications which are trying to use the same data, and this is a far more likely possibility than a power failure.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!