我正在使用UCanAccess来操作Access数据库.在调用时executeUpdate我得到了异常:
net.ucanaccess.jdbc.UcanaccessSQLException:UCAExc ::: 3.0.2意外的页面类型1(Db = db.accdb; Table = MyTable; Index = PrimaryKey)
它只在尝试更新一个特定行时发生 - 我已经知道如何在Access DB中修复此问题.
问题在于Logger,在抛出此异常后我抓住了它,我记录了一条信息消息但未显示,所有下一条日志消息也未显示.
我想在不修复数据库的情况下修复它的原因是因为当它发生一次时,用户应该关闭应用程序以便记录下一个动作,如果他没有,那么我将无法知道他做了什么.
这是我的代码:
public static void main(String args[]) {
Logger logger = Logger.getLogger("myLogger");
PreparedStatement pst = null;
try {
FileHandler fileHandler = new FileHandler("myLog.log", 0, 1, true);
// Set formatter to put the time, the message, and the exception if exists
fileHandler.setFormatter(new Formatter() {
@Override
public String format(LogRecord record) {
Throwable t = record.getThrown();
String stackTrace = "";
if (t != null) …Run Code Online (Sandbox Code Playgroud)