Stepan Yakovenko
Stepan Yakovenko

Reputation: 9206

hxtt DBF driver locks its files

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?

Upvotes: 3

Views: 1174

Answers (1)

Stepan Yakovenko
Stepan Yakovenko

Reputation: 9206

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

Upvotes: 2

Related Questions