本文整理了Java中com.healthmarketscience.jackcess.Database.close()
方法的一些代码示例,展示了Database.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Database.close()
方法的具体详情如下:
包路径:com.healthmarketscience.jackcess.Database
类名称:Database
方法名:close
[英]Close the database file (and any linked databases). A Database must be closed after use or changes could be lost and the Database file corrupted. A Database instance should be treated like any other external resource which would be closed in a finally block (e.g. an OutputStream or jdbc Connection).
[中]关闭数据库文件(以及所有链接的数据库)。数据库在使用后必须关闭,否则更改可能会丢失,并且数据库文件已损坏。数据库实例应被视为在finally块中关闭的任何其他外部资源(例如OutputStream或jdbc连接)。
代码示例来源:origin: pentaho/pentaho-kettle
void closeDatabase() throws IOException {
db.close();
}
代码示例来源:origin: pentaho/pentaho-kettle
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 );
}
代码示例来源:origin: pentaho/pentaho-kettle
try {
if ( db != null ) {
db.close();
代码示例来源:origin: pentaho/pentaho-kettle
database.close();
代码示例来源:origin: pentaho/pentaho-kettle
db.close();
代码示例来源:origin: pentaho/pentaho-kettle
accessDatabase.close();
代码示例来源:origin: org.integratedmodelling/klab-common
@Override
public void run() {
try {
if (_db != null) {
_db.close();
}
} catch (IOException e) {
}
}
});
代码示例来源:origin: ujmp/universal-java-matrix-package
public void close() throws IOException {
database.close();
}
代码示例来源:origin: dk.eobjects.metamodel/MetaModel-access
@Override
protected void finalize() throws Throwable {
super.finalize();
_database.close();
}
}
代码示例来源:origin: org.eobjects.metamodel/MetaModel-access
@Override
protected void finalize() throws Throwable {
super.finalize();
_database.close();
}
}
代码示例来源:origin: apache/tika
if (db != null) {
try {
db.close();
} catch (IOException e) {
代码示例来源:origin: com.healthmarketscience.jackcess/jackcess
@Override
public void close() throws IOException {
if(_linkedDbs != null) {
for(Database linkedDb : _linkedDbs.values()) {
linkedDb.close();
}
}
_pageChannel.close();
}
代码示例来源:origin: AccelerationNet/access2csv
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();
}
}
代码示例来源:origin: AccelerationNet/access2csv
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();
}
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
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);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
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);
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
public void reloadDbIO() throws IOException {
this.dbIO.flush();
this.dbIO.close();
for (OnReloadReferenceListener listener : onReloadListeners) {
listener.onReload();
}
this.dbIO = open(dbFile, this.pwd);
}
代码示例来源:origin: AccelerationNet/access2csv
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();
}
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
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;
}
代码示例来源:origin: net.sf.ucanaccess/ucanaccess
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;
}
内容来源于网络,如有侵权,请联系作者删除!