2

Heya all,

I am having some issues and maybe someone has an answer for me!

I am trying to read write some *DBF table from a java application. I have found this code :

try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String connString="jdbc:odbc:Driver={Microsoft dBASE Driver *.dbf)};DefaultDir=C:\\test";//DefaultDir 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();
        }

This code is working fine with a 32-bit version of windows but when I try on 64 bit, it gives me the error :

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I have looked it up and the best answer found was about something to do with playing with the DNs in system32 or sysWOW64 but I wasent able to get threw it or my understanding was no good enough....

Here is the link with that answer:

SO answer that I found

thanks in advance...

Community
  • 1
  • 1
Bamizas
  • 43
  • 6
  • 64 bit version here http://www.microsoft.com/en-ie/download/details.aspx?id=13255 – Fionnuala Feb 06 '13 at 18:48
  • Already tried that option, unfortunately, didn't fix it.. – Bamizas Feb 06 '13 at 18:53
  • FoxPro(dbf) is only 32 bit and there are no 64 bit drivers from microsoft. The link above is for Access and not dbf. Further info here http://stackoverflow.com/questions/6543670/visual-foxpro-driver-for-64-bit-windows-7 – Archlight Jan 23 '14 at 18:59

1 Answers1

1

I had the same problem and I solved it uninstalling the 64-bit version of the JDK 6 and installing instead the 32-bit one. Thus my application started back to work fine with queries/updates on my *.DBF files :)

Hope this helps!

leodali
  • 301
  • 3
  • 16