1. 程式人生 > 實用技巧 >64位系統下access的64位odbc驅動

64位系統下access的64位odbc驅動

ACCESS使用64位odbc

下載orca編輯器地址:

https://www.technipages.com/download-orca-msi-editor

下載access64位odbc(AccessDatabaseEngine_X64.exe)地址:

http://www.microsoft.com/downloads/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

如果直接安裝AccessDatabaseEngine_X64.exe時會提示已經安裝32位驅動,無法正常安裝。

Qt的編譯的64位程式無法訪問access資料庫,只能編譯為32位程式訪問access資料庫。

因為系統office2010一下的版本預設安裝的是access32位的odbc驅動程式。

//odbc資料來源定義中路徑符號"\"和"/"要換成"\\"

//編譯為64為版本(office2010以上版本)"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};FIL={MS Access};DBQ=c:\\test.accdb;"

//編譯為32位可以正常訪問(office2010以下版本)QString("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=acs.mdb;");

可下列辦法解決ACCESS

按鑽過64位odbc驅動程式的問題。

一、安裝orca編輯器

下載orca編輯器地址:

https://www.technipages.com/download-orca-msi-editor

二、下載access64位odbc(AccessDatabaseEngine_X64.exe)地址:

http://www.microsoft.com/downloads/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

三、解壓AccessDatabaseEngine_X64.exe後,用orca編輯器開啟AceRedist.msi檔案,

選擇LaunchCondition項,選擇BLOCKINSTALLATION行刪除,然後儲存,執行AceRedist.msi檔案,即可正常安裝access的64位odbc驅動。

四、安裝完成後,在控制面板—管理工具—odbc64位資料來源驅動中可以看到access驅動,表示安裝成功。

qt access 資料庫

下列內容來自於:https://www.cnblogs.com/lvdongjie/p/11780618.htm

#include <QCoreApplication>

#include <QSqlDatabase>
#include <QSqlQuery>
#include <QtDebug>
#include <QSqlError>
int main(int argc, char *argv[])
{
 QCoreApplication a(argc, argv);
// QSqlDatabase db;
// db = QSqlDatabase::addDatabase("QODBC","test");
// db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};FIL={MS Access};DBQ=E:/test.mdb");
// if (db.open()) {
// qDebug() << "xxxxxxxxxxxxxxxx";
// }
// else {
// qDebug() << db.lastError();
// }
// return a.exec();\ QCoreApplication a(argc, argv);
 QSqlDatabase db;
 db = QSqlDatabase::addDatabase("QODBC","test");
 db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};FIL={MS Access};DBQ=testacc64");
 if (db.open()) {
 qDebug() << "xxxxxxxxxxxxxxxx";
 }
 else {
 qDebug() << db.lastError();
 }
 return a.exec();
}
int createSQLServerConnection()
{
 loadPlugin();
 QString strHost = "10.211.55.4";
 int port = 3306;
 QString strDbName = "SQLData";
 QString strUserName = "test";
 QString strUserPwd = "123321";
 QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
 QString strconn = QString("Driver={sql server};SERVER=%1;PORT=%2;DATABASE=%3;UID=%4;PWD=%5;")
 .arg(strHost)
 .arg(port)
 .arg(strDbName)
 .arg(strUserName)
 .arg(strUserPwd);
 db.setDatabaseName(strconn);
 if (!db.open())
 {
 qDebug() <<"error_SqlServer:" << db.lastError().text();
 return 1201;
 }
 return 0;
}
access 
"Driver={microsoft access driver(*.mdb)};dbq=*.mdb;uid=admin;pwd=pass;"
dBase
 "Driver={microsoft dbase driver(*.dbf)};driverid=277;dbq=***;"
oracle 
"Driver={microsoft odbc for oracle};server=oraclesever.world;uid=admin;pwd=pass;"
MSSQL server 
"Driver={sql server};server=servername;database=dbname;uid=sa;pwd=pass;"
MS text 
"Driver={microsoft text driver(*.txt; *.csv)};dbq=**;extensions=asc,csv,tab,txt;Persist SecurityInfo=false;"
Visual Foxpro
 "Driver={microsoft Visual Foxpro driver};sourcetype=DBC;sourceDB=*.dbc;Exclusive=No;"
MySQL 
"Driver={mysql};database=yourdatabase;uid=username;pwd=yourpassword;option=16386;"
SQLite 
"Driver={SQLite3 ODBC Driver};Database=D:\SQLite\*.db"
PostgreSQL 
"Driver={PostgreSQL ANSI};server=127.0.0.1;uid=admin;pwd=pass;database=databaseName"

64位系統安裝ODBC驅動的方法

來自於:https://blog.csdn.net/dongqinglove/article/details/9175863

dongqinglove2013-06-26 09:58:572207收藏1

分類專欄:c#基礎知識

為了更充分的利用硬體資源,我想很多人都開使用64位作業系統了,同時你可以也發現了在64位作業系統上ODBC的驅動找不到了,所以ODBC的東西都沒法用了。 因為2007以前版本的Office只有32位版本,所以我們不能在64位系統上使用ODBC。使用Autodesk 64位產品的使用者,包括64位的MapGuide Enterpr和 Map3D,肯定也正為這個問題深感苦惱。一個好訊息是Office 2010 有了64位版本,同時微軟也釋出了64為的ODBC驅動程式,這個驅動可以從下面的地址下載:

http://www.microsoft.com/downloads/details.aspx?familyid=C06B8369-60DD-4B64-A44B-84B371EDE16D&displaylang=en

多少情況下我們的機器上可能都已經安裝了Office 2007等32位的Office,下載AccessDatabaseEngine_X64.exe安裝時多半會碰到下面的錯誤資訊,從而無法繼續。

莫非我真的只有升級到Office 2010 64位版一條路可以走了麼?可是貌似微軟都建議我們用32位的而不是64位的,我可不想就為這一個ODBC去升級惹麻煩。下面是Microsoft關於是用Office 32還是64的回答。

Yes, 64-bit Office 2010 product upgrades will be available. However we strongly recommend most users install 32-bit version of Office 2010 on both 32 and 64-bit Operating Systems because currently many common add-ins for Office will not function in the 64-bit edition. The 64-bit installation of Microsoft Office 2010 products will be available for users who commonly useverylarge documents or data set and need Excel 2010 programs to access greater than 2GB of memory. There may be technical issues with the 64-bit version and in order to install a 64-bit version of Office 2010 product users must have a 64-bit supported operating system on their PC.

http://office2010.microsoft.com/en-us/tech-guarantee/microsoft-office-2010-technology-guarantee-faq-HA101812304.aspx?redir=0

所以應該找個辦法能在安裝了32位Office的機器上安裝這個64位的ODBC驅動。下面是更改方法:

先用7zip把AccessDatabaseEngine_X64.exe接壓縮,裡面會有一個AceRedist.msi安裝檔案,然後用Orca(下載地址http://www.technipages.com/wp-content/uploads/2007/11/orca.Msi)開啟這個MSI,找到LaunchCondition裡面的BLOCKINSTALLATION,刪掉,儲存。現在在執行AceRedist.msi,哈哈,非常順利。經過我的測試,使用上也完全沒問題。