问题描述
|
我这里有访问MySQL数据库的Java代码。它检查表是否存在。该表已删除并且不存在,尽管下面的代码说该表存在。
private Boolean tableExists(String globalId) {
// schema Test
DBResult result = db.selectQuery(\"SELECT table_name
FROM information_schema.tables
WHERE table_schema = \'\"+schema+\"\'
AND table_name = \" + \"\\\'\" + \"category_\"+globalId.split(\"-\")[1]+ \"\\\'\"+\";\");
if(result.getRowCount() > 0) {
logger.info(\" Table exist \"+globalId);
return true;
} else {
logger.info(\"table does not exist \"+ globalId);
return false;
}
}
该方法返回true,表示该表存在。稍后,程序会发现该表不存在并崩溃。请问是什么问题?该程序在Tomcat 6上运行。
解决方法
重新启动the1。 (如有必要,杀死进程)。那应该工作。
MySQL
中存在同步问题。