來源:lukeyang2000 發(fā)布時間:2018-11-14 11:11:58 閱讀量:1041
在Win7 x64下安裝最新版的PostgreSQL 9.x 后,從其官網(wǎng)下載最新的 ODBC驅(qū)動,分為普通的32位和64位版本,正常安裝后,從已安裝軟件列表里可以看到兩個版本的驅(qū)動都已經(jīng)正確顯示出來。但是在管理工具下ODBC數(shù)據(jù)源界面里只能選擇64位的PostgreSQL驅(qū)動,32位竟然沒有。如此一來,一些32位的應用軟件就沒法利用ODBC鏈接到數(shù)據(jù)庫了(嘗試選取地話,會報告選取的數(shù)據(jù)源(64位)和應用程序的系統(tǒng)構架(32位)不一致而失?。?。
一開始以為在ODBC數(shù)據(jù)源無法選擇32位驅(qū)動是和安裝驅(qū)動的順序有關,或者32位和64位驅(qū)動互相沖突。卸卸裝裝反復幾次,問題依舊。后來查閱psqlodbc項目組的FAQ才找到解決辦法:
從cmd運行 %SystemRoot%\syswow64\odbcad32.exe來配置32位的PostgreSQL ODBC數(shù)據(jù)源。odbcad32.exe運行界面和管理工具下ODBC數(shù)據(jù)源配置界面類似,但是是用來管理32位驅(qū)動的。Win7 x64管理工具下ODBC數(shù)據(jù)源配置程序(%SystemRoot%\system32\odbcad32.exe)實際上是64位的驅(qū)動管理。
官方的解釋為:
Contributed by Mark Wood (mw@mcwood.co.uk)
Though you can install 32 bit ODBC drivers on Win X64 as usual, you can't configure 32-bit DSNs via oridinary control panel or ODBC datasource administrator.
How to configure 32 bit ODBC drivers on Win x64
Configure ODBC DSN from %SystemRoot%\syswow64\odbcad32.exe. Click
Start->Run
Enter: %SystemRoot%\syswow64\odbcad32.exe
Hit return
This looks the same as the driver manager you might run from the control panel, but is for managing 32bit drivers. If you run odbcad32.exe from the System32 directory, you are actually running the 64bit driver manager.
詳情請參考psqlodbc項目組的FAQ:http://psqlodbc.projects.postgresql.org/faq.html#6.8
另:對于MySQL的ODBC驅(qū)動,同時安裝32位和64位后,在已安裝軟件列表里出現(xiàn)的兩個一模一樣名字的條目。通過管理工具下ODBC數(shù)據(jù)源配置程序配置的64位驅(qū)動的數(shù)據(jù)源在32位的應用軟件里是沒有問題的 - 不知道MySQL是怎么做的,可能是在創(chuàng)建64位驅(qū)動的數(shù)據(jù)源的同時自動創(chuàng)建一個32為數(shù)據(jù)源。
---------------------