Question

My web app receives archive, unpacks it to temp folder, reads data from extracted DBFs and then should kill garbage. Though it fails to kill temp folder since DBF files in it are locked. Here is a sample code:

public static void main( String a[] ) throws Exception {

    Class.forName( "com.hxtt.sql.dbf.DBFDriver" ).newInstance();
    String url = "jdbc:DBF:/C:/TEMP/";
    Properties properties = new Properties();
    properties.setProperty( "charSet", "cp866" );
    Connection con = null;
    Statement st = null;
    java.sql.Driver d = null;
    con = DriverManager.getConnection( url, properties );
    d = DriverManager.getDriver( url );
    st = con.createStatement();
    ResultSet rs = st.executeQuery( "SELECT * FROM 6QQQ201010" );
    rs.close();
    st.close();
    con.close();

}

I put breakpoint past last line and 6QQQ201010.DBF is still locked. Any ideas? Or just a bug in the driver?

Was it helpful?

Solution

Add properties.setProperty( "delayedClose", "0" ); and driver would close handles imediately.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top