在 java/selenium 中读取 DBF 文件

Reading DBF file in java/selenium

我正在尝试读取 FoxPo .dbf 文件,但出现以下错误行:

while ((rowObjects = reader.nextRecord()) != null)

错误:

com.linuxense.javadbf.DBFException: Failed to parse Number: empty String at com.linuxense.javadbf.DBFReader.nextRecord(DBFReader.java:310) at datamigration.DataMigration.main(DataMigration.java:34)

我们将不胜感激。

谢谢,

如果我的代码如下:


package datamigration;

import java.io.*;
import com.linuxense.javadbf.*;

public class DataMigration {

    public static void main(String args[]) {

        try {

            InputStream inputStream = new FileInputStream("D:/projects/DataMigration/data/customer.dbf");

            DBFReader reader = new DBFReader(inputStream);

            reader.setCharactersetName("gbk");
            int numberOfFields = reader.getFieldCount();

            for (int i = 0; i < numberOfFields; i++) {

                DBFField field = reader.getField(i);

                System.out.println(field.getName());
            }

            Object[] rowObjects;

            while ((rowObjects = reader.nextRecord()) != null) {

                for (int i = 0; i < rowObjects.length; i++) {

                    System.out.println(rowObjects[i]);
                }
            }
            inputStream.close();

        } catch (DBFException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}

你看过各种 'finds' 在:
Google Search Results for: java connect to foxpro database