Hxtt DBF driver locks its files

My web application receives the archive, unpacks it into the temp folder, reads the data from the extracted DBF, and then kills the garbage. Although he cannot kill the temporary folder, because the 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();

} Code>

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

+3
source share
1 answer

Add .setProperty properties ("delayedClose", "0"); and the driver will immediately close the handles.

+2
source

Source: https://habr.com/ru/post/1776389/


All Articles