2013-02-06 34 views
2

賀雅全部,64位java讀寫* dbf

我有一些問題,也許有人有我的答案!

我想讀取從java應用程序寫入一些* DBF表。我發現這個代碼:

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(); 
     } 

此代碼工作正常與Windows的32位版本,但是當我嘗試在64位,它給我的錯誤:

[微軟] [ODBC驅動程序經理]數據源名稱未找到,沒有指定默認驅動程序

我已經查閱了它,發現的最佳答案是關於在system32或sysWOW64中使用DN做些事情,但我非常想把它扔掉,理解是不夠好的......

下面是這個問題的答案的鏈接:

SO answer that I found

在此先感謝...

+0

64位版本在這裏http://www.microsoft.com/en-ie/download/details.aspx?id=13255 – Fionnuala

+0

已經嘗試過該選項,不幸的是,沒有修復它.. – Bamizas

+0

FoxPro(dbf)只有32位,並沒有來自微軟的64位驅動程序。上面的鏈接是爲Access而不是dbf。更多信息在這裏http://stackoverflow.com/questions/6543670/visual-foxpro-driver-for-64-bit-windows-7 – Archlight

回答

0

我有同樣的問題,我解決它卸載JDK 6的64位版本,然後安裝,而不是這是32位的。 因此,我的應用程序開始恢復正常工作,查詢/更新我的* .DBF文件:)

希望這有助於!