j256 / ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
http://ormlite.com/
ISC License
1.59k stars 366 forks source link

Lock table when drop table #103

Open leichenlei opened 5 years ago

leichenlei commented 5 years ago

CODE:

public static void dropTable(Connection conn, String tableName) throws SQLException { try (Statement statement = conn.createStatement()) { statement.execute("DROP TABLE " + tableName); } }

EXCEPTION: org.sqlite.SQLiteException: [SQLITE_LOCKED] A table in the database is locked (database table is locked) at org.sqlite.core.DB.newSQLException(DB.java:909) at org.sqlite.core.DB.newSQLException(DB.java:921) at org.sqlite.core.DB.execute(DB.java:822) at org.sqlite.core.CoreStatement.exec(CoreStatement.java:75) at org.sqlite.jdbc3.JDBC3Statement.execute(JDBC3Statement.java:61)