Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 460
pinkb Avatar asked Nov 09 '11 12:11

pinkb


1 Answers

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.

like image 77
pinkb Avatar answered Sep 21 '22 20:09

pinkb