What is the best opensource dbf driver for java? [closed]

大兔子大兔子 提交于 2019-11-28 05:28:45
try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String connString="jdbc:odbc:Driver={Microsoft dBASE Driver (*.dbf)};DefaultDir=E:\\db";//DeafultDir indicates the location of the db
            Connection connection=DriverManager.getConnection(connString);
            String sql="SELECT * FROM table_name where condition";// usual sql query
            Statement stmt=connection.createStatement();
            ResultSet resultSet=stmt.executeQuery(sql);
            while(resultSet.next())
            {
                System.out.println();
            }
            System.out.println();
        }
        catch (ClassNotFoundException e)
        {
            e.printStackTrace();
        }
        catch (SQLException e)
        {
            e.printStackTrace();
        }

It works. And I guess there will be no need to explore for other (open/closed) apis as Java has provided an excellent way to read/write dbf.

Thank you all.

You can try to use https://github.com/iryndin/jdbf - a simple Java library to read/write DBF files. I am the author of this library and it works quite good in my production apps. It is very simple.

Please give it a try.

user1037843

dans-dbf is a good option to access dbf files, but it has a custom api (ie: not sql).

I would recommend you to dump the dbf files into db tables (mysql with myisam engine will do the trick or innodb if transaction/consistency checking is required).

Then you can dump back to dbf as needed.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!