无法使用 dBase 驱动程序从 Java 更新 dbf



你好,我有一个想要更新的dbf文件,但每次我尝试运行update语句时,系统都会显示使用Microsoft dBase driverthat the Index is not found

这是代码:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        String connString="jdbc:odbc:Driver={Microsoft dBASE Driver (*.dbf)};DefaultDir=Path";
        Connection connection=DriverManager.getConnection(connString);

        String sql;
        Calendar cal = Calendar.getInstance();
        cal.getTime();
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");

        String _time =sdf.format(cal.getTime());//Adding the Time of set the product.

        sql="UPDATE [MESAS] SET PER_MEZ="+args[2]+", HOR_MEZ='"+_time+"', MES_MEZ='"+args[2]+"' WHERE COD_MEZ='M01'";
    Statement query = connection.createStatement();
    query.execute(sql);

尝试使用executeUpdate而不是execute。在执行表UPDATE时,execute出现了一些奇怪的问题。

最新更新