Error deleting a SQLite Database

1

Good I have a java program that creates a sqlite database when I finish the program I want the database to be deleted so that there is no record of it on the computer. I have the following code:

public void borrarSQLite() {

    try {
            con.getS().executeUpdate("DROP DATABASE peval2");
            System.out.println("BD SQLite eliminada correctamente");
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        System.err.println("ERROR AL ELIMINAR LA BD SQLite");
    }
}

I tried running the query directly in SQLite and it says the following:

near "DATABASE": syntax error: drop DATABASE
    
asked by Dejuanfran99 09.11.2018 в 17:27
source

1 answer

3

How do I discard an SQLite database?

People accustomed to working with other databases are used to having a DROP DATABASE , but in SQLite there is no similar command.

The reason? In SQLite there is no "database server": SQLite is an integrated database, and all its database is contained in a file. Therefore, there is no need for a SQLite "drop database" command, all you have to do to delete the database is to delete the SQLite database file that you were accessing.

    
answered by 09.11.2018 / 17:38
source