java - Unable to drop table via Jackcess using getSystemTable and findFirstRow -


why can't cursor findfirstrow when try use jackcess find row need delete in order drop table?

private static void deletetable(database db, string tablename) throws ioexception {     table table = db.getsystemtable(tablename);     if (table == null) {         return;     }     cursor cursor = table.getdefaultcursor();     map<string, object> criteria = new hashmap<string, object>();     criteria.put("name", tablename);     criteria.put("type", (short) 1);     if (cursor.findfirstrow(criteria)) {         table.deleterow(cursor.getcurrentrow());         log.e(tag, "delete " + tablename + "   success!");     } else {         log.e(tag, "can't find table");//run here     }     db.flush();     db.close(); } 

p.s.: no reported exception

your mistake opening table want delete, not system table holds list of database objects. instead of

table table = db.getsystemtable(tablename); 

you need use

table table = db.getsystemtable("msysobjects"); 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -