iT邦幫忙

0

[servlet]ODBC讀不到Access的.mdb資料

匿名 2012-06-11 21:48:5915191 瀏覽

程式在 XP X86下成功
卻在 Win7 x64 下讀不出來 該出來的都出來只差.mdb的資料表格是一片空白。

匿名 檢舉
自己爬到了Ans:
If you are working on 64 bit version of Windows then you can use 64 bit and 32 bit environment. Such environment consist of Java (JDK or JRE) and database drivers. For Java applications the best way of accessing database is via JDBC driver. Then you need not to worry about 32 or 64 bit environment, you only put .jar file or files in directory that is part of CLASSPATH environment variable.

In case of MS Access you can use JDBC-ODBC bridge that is present by default in Sun (now Oracle) implementations of JRE. But before that you must configure ODBC connection with MS-Access database. This can be done via ODBC Manager or via connect string.

I think connect string is easier, because it looks like:

jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\\Nwind.mdb
all you have to do is to point at your .mdb file. This should work with 32 and 64 bit versions of JRE.

c:\windows\syswow64\odbcad32.exe (32 bit)
c:\windows\system32\odbcad32.exe (64 bit)
匿名 檢舉
http://stackoverflow.com/questions/5922079/how-do-i-access-connection-with-java

http://stackoverflow.com/questions/10289655/how-to-connect-to-a-32-bit-access-database-from-64-bit-jvm

http://stackoverflow.com/questions/7459928/problem-trying-to-load-odbcad32-on-64-bit-machine
感謝分享讚
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

4
obiwanking
iT邦新手 3 級 ‧ 2012-06-13 11:00:51
最佳解答

Win7 x64 odbc有兩個路徑:

  1. C:\Windows\System32\odbcad32.exe
  2. C:\Windows\SysWOW64\odbcad32.exe

你試試看2個都設定, 程式能不能抓取到?
如果可以, 再進一步去debug程式實際是抓取哪一個odbc版本的設定值

匿名 檢舉

我是用 C:\Windows\SysWOW64\odbcad32.exe 上圖工作管理員有顯示*32
C:\Windows\System32\odbcad32.exe 是64位元 ODBC沒驅動就不用試了

剛偵測了一下 我的ODBC(*32) 根本就沒有去讀.mdb資料庫 (沒工作)

X64系統下使用x32 ODBC 的寫法也是這樣嗎?

<pre class="c" name="code">
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     cn=DriverManager.getConnection("jdbc:odbc:BookStore");
匿名 檢舉

要到期了 不刪問題 留著供參考
~回答區沒有最佳解答~ ~最佳解答在討論區~

我要發表回答

立即登入回答