jeudi 31 décembre 2015

Removal of SQLite database file using Java doesn't work

These code blocks work but... If I use this blocks one by one my application doesn't remove database file. (result is equeal to false)

sqlite manage part:

    // sqlite manage

        Class.forName("org.sqlite.JDBC").newInstance();            
            conn = DriverManager.getConnection("jdbc:sqlite:/"+ myDBpath);
            stmt = conn.createStatement();
    //some calculations
    stmt.close();

removal part:

    //remove this file
    boolean result = new File(myDBpath).delete();

But if I use only remove code without database operations it works! Why? How can I avoid it?

Aucun commentaire:

Enregistrer un commentaire