Search code examples
javadbfjdbc-odbc

What is the best opensource dbf driver for java?


Can anybody please mention the best available opensource odbc:jdbc driver to read / write dbf.? I have a dbf file which I would like to query (select/update) via a web application (Tomcat app).

Any help/tips would be appreciative.

Thank you.


Solution

  • 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.