SQLite - executeUpdate exception not caught when database does not exist? (Java) -


so purposely trying break program, , i've succeeded.

i deleted sqlite database program uses, while program running, after created connection. attempted update database seen below.

statement stmt; try {     stmt = foo.con.createstatement();     stmt.executeupdate("insert "+table+" values (\'" + itemtoadd + "\')"); } catch(sqlexception e) {     system.out.println("error: " + e.tostring()); } 

the problem is, didn't catch exception, , continued run if database updated successfully. meanwhile database didn't exist @ point since after deleted it.

  • doesn't check if database still exists when updating?
  • do have check database connection manually, every time update ensure database wasn't corrupted/deleted?
  • is way done, or there simpler/more robust approach?

thank you.

interestingly, found if delete database when using , attempt update it, updates database in new location (in trash!). cannot permanently delete while in trash can , accessing via program.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -