Hi
In november 2005 I purchased a licence for HXTT Access, and now
I'm experiencing some problems using this tool.
I'm using a JDK 1.5 on a Windows XP platform.
I created a java Application which access an mdb file on my PC, and
this application reads all the tables found in the mdb, and creates
a cvs file for each table, writing the table data in the cvs file.
The problems arise when the same application try to move the
mdb file in a new dir, at the end of the export operations.
The move operation does never succeed, and the mdb file is never moved.
I move the file using the java method renameTo() of the class java.io.File,
and I'm sure to close the java.sql.Connection, java.sql.Statement
and java.sql.Resultset used in the export operation.
Why this behaviour?
Thanks,
Gianluca
|
>and I'm sure to close the java.sql.Connection, java.sql.Statement
>and java.sql.Resultset used in the export operation.
>Why this behaviour?
Because HXTT Access will use delayed transaction to close MDB files. It will release MDB files after 5~10s if there's no any connection or ResultSet to use it. The preferable remove mdb file method is:
public static boolean renameTo(File src,File dest){
int timeout=0
while(!src.renameTo(dest){
if(timeout<12000){
return false;
}
try{
Thread.sleep(50);
timeout+=50;
}catch (InterruptedException e) {}
}
return true;
}
|