void closeDatabase() throws IOException { db.close(); }
public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (AccessInputMeta) smi; data = (AccessInputData) sdi; if ( data.t != null ) { data.t = null; } if ( data.rw != null ) { data.rw = null; } if ( data.readrow != null ) { data.readrow = null; } try { if ( data.d != null ) { data.d.close(); data.d = null; } if ( data.file != null ) { data.file.close(); data.file = null; } data.daf = null; } catch ( Exception e ) { // ignore this } super.dispose( smi, sdi ); }
try { if ( db != null ) { db.close();
database.close();
accessDatabase.close();
@Override public void run() { try { if (_db != null) { _db.close(); } } catch (IOException e) { } } });
public void close() throws IOException { database.close(); }
@Override protected void finalize() throws Throwable { super.finalize(); _database.close(); } }
@Override protected void finalize() throws Throwable { super.finalize(); _database.close(); } }
if (db != null) { try { db.close(); } catch (IOException e) {
@Override public void close() throws IOException { if(_linkedDbs != null) { for(Database linkedDb : _linkedDbs.values()) { linkedDb.close(); } } _pageChannel.close(); }
static void export(File inputFile, String tableName, boolean withHeader, File outputDir, String csvPrefix, boolean applyQuotesToAll, String nullText) throws IOException{ Database db = DatabaseBuilder.open(inputFile); try{ export(db, tableName, new FileWriter(new File(outputDir, csvPrefix + tableName + ".csv")), withHeader, applyQuotesToAll, nullText); }finally{ db.close(); } }
static void exportAll(File inputFile, boolean withHeader, File outputDir, String csvPrefix, boolean applyQuotesToAll, String nullText) throws IOException{ Database db = DatabaseBuilder.open(inputFile); try{ for(String tableName : db.getTableNames()){ String csvName = csvPrefix + tableName + ".csv"; File outputFile = new File(outputDir, csvName); Writer csv = new FileWriter(outputFile); try{ System.out.println(String.format("Exporting '%s' to %s", tableName, outputFile.toString())); int rows = export(db, tableName, csv, withHeader, applyQuotesToAll, nullText); System.out.println(String.format("%d rows exported", rows)); }finally{ try{ csv.flush(); csv.close(); }catch(IOException ex){} } } }finally{ db.close(); } }
void shutdown(Session _session) throws Exception { DBReferenceSingleton.getInstance().remove(this.dbFile.getAbsolutePath()); if (this.immediatelyReleaseResources) { for (OnReloadReferenceListener listener : onReloadListeners) { listener.onReload(); } } this.memoryTimer.timer.cancel(); this.dbIO.flush(); this.dbIO.close(); this.closeHSQLDB(_session); }
public static final JackcessDenseObjectMatrix2D toFile(File file, Object... parameters) throws IOException { Database db = DatabaseBuilder.open(file); Set<String> tables = db.getTableNames(); String tablename = null; if (parameters.length != 0) { tablename = StringUtil.convert(parameters[0]); } if (tablename == null) { if (tables.size() == 1) { tablename = db.getTableNames().iterator().next(); } } db.close(); if (tablename == null) { throw new IllegalArgumentException( "please append the table name, i.e. one of these tables: " + tables); } return new JackcessDenseObjectMatrix2D(file, tablename); }
public void reloadDbIO() throws IOException { this.dbIO.flush(); this.dbIO.close(); for (OnReloadReferenceListener listener : onReloadListeners) { listener.onReload(); } this.dbIO = open(dbFile, this.pwd); }
static void schema(File inputFile) throws IOException{ Database db = DatabaseBuilder.open(inputFile); try{ for(String tableName : db.getTableNames()){ Table table = db.getTable(tableName); System.out.println(String.format("CREATE TABLE %s (", tableName)); for(Column col : table.getColumns()){ System.out.println(String.format(" %s %s,", col.getName(), col.getType())); } System.out.println(")"); } }finally{ db.close(); } }
private boolean checkInside() throws IOException { boolean reload = checkInside(this.dbIO); if (reload) { return true; } for (File fl : this.links) { Database db = DatabaseBuilder.open(fl); reload = checkInside(db); db.close(); if (reload) { return true; } } return false; }
private static boolean hasPassword(File fl) throws IOException { Database db; try { db = DatabaseBuilder.open(fl); } catch (IOException e) { DatabaseBuilder dbb = new DatabaseBuilder(); dbb.setReadOnly(true); dbb.setFile(fl); db = dbb.open(); } String pwd = db.getDatabasePassword(); db.close(); return pwd != null; }