java的最佳开源dbf驱动程序是什么?

pin*_*nkb 16 java dbf jdbc-odbc

任何人都可以提一下最好的开源odbc:jdbc驱动程序来读/写dbf.我有一个dbf文件,我想通过Web应用程序(Tomcat应用程序)查询(选择/更新).

任何帮助/提示都会很有意义.

谢谢.

pin*_*nkb 15

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();
        }
Run Code Online (Sandbox Code Playgroud)

有用.而且我猜没有必要探索其他(开放/封闭)apis,因为Java提供了一种读/写dbf的绝佳方法.

谢谢你们.

  • JDBC ODBC Bridge现已弃用,将在JDK 8中消失. (4认同)

iry*_*din 9

您可以尝试使用https://github.com/iryndin/jdbf - 一个简单的Java库来读/写DBF文件.我是这个库的作者,它在我的生产应用程序中运行良好.这很简单.

请试一试.