在java / selenium中读取DBF文件

时间:2017-09-27 04:28:00

标签: java database selenium foxpro

我正在尝试读取FoxPo .dbf文件,但是对于行:

低于错误

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

ERROR:

  

com.linuxense.javadbf.DBFException:无法解析Number:empty   串       在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();
        }

    }
}

1 个答案:

答案 0 :(得分:0)

你看过各种各样的发现吗?在:
    Google Search Results for: java connect to foxpro database