Closing A Database



The following methods will close SQLite and db4o database accordingly:

SQLite:

SqlExample.java: close
01/** 02 * Close database connection 03 */ 04 public static void close() { 05 if(_db != null){ 06 long startTime = System.currentTimeMillis(); 07 _db.close(); 08 logToConsole(startTime, "Database committed and closed: ", false); 09 _db = null; 10 } 11 }
 

db4o:

Db4oExample.java: close
01/** 02 * Close database connection 03 */ 04 public static void close() { 05 if(_container != null){ 06 long startTime = System.currentTimeMillis(); 07 _container.close(); 08 logToConsole(startTime, "Database committed and closed: ", false); 09 _container = null; 10 } 11 }