Is it not possible to open M.S. access file?
-
Hi
You must use ODBC to open a ms access file. -
Hello everyone,
Is it not possible to open M.S. Access file in Qt.
I tried with SQLITE file and i can open it but not the M.S.Access file.
Is there any special way to open Microsoft access fileSee also your other post and the documentation It is an example there.
I would recommend trying with a small example and a less complicated name for the file path.
-
@mrjj
I am using following code
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={Microsoft Access Driver(*.accdb)};FIL={MS Access};DBQ=C:.........\Database1.accdb");if(db.open())
qDebug() << "oK";
else
qDebug() << db.lastError();and i am getting the following error
QSqlError("0", "QODBC3: Unable to connect", "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified")@koahnig
I saved my file on my desktop, i think thats the most easy path and the above code is the simplest i guess. -
@hskoglund
i tried absolute filepath also but i am getting the same error -
@hskoglund
yes i tried with double backslashes and also with forward slashes. but same error -
Also, did you VERIFY that odbc is available and working ?
https://www.isunshare.com/windows-10/5-ways-to-open-odbc-data-source-administrator-in-windows-10.htmlThis might not be related to Qt at all.
If you never worked with ODBC before, please study a bit
http://www.dummies.com/programming/sql/how-to-use-odbc-to-access-sql-data/ -
Hi, I googled a bit and found this thread
So if you do not have Microsoft Office installed you need to download the driver for MS Access .accdb files
-
Hi, I googled a bit and found this thread
So if you do not have Microsoft Office installed you need to download the driver for MS Access .accdb files
Indeed you must install the Access ODBC driver. The driver is independent from installed Office !
(Be aware Windows like to kill this driver after windows-update. So you must reinstall it sometimes.)Then you must look in the ODBC tool from windows to find out the correct driver name. This is the correct for me (is not the same as you use):
"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};" -
i already tried downloaded and intalled the drivers, even though i have M.S Office installed on my computer. But getting the same error.
-
i already tried downloaded and intalled the drivers, even though i have M.S Office installed on my computer. But getting the same error.
Hi @rockon209
which Qt Version do you use? -
Hi @rockon209
the QtCompany had the idea to do not distribute the binarys for the ODBC driver anymore. That was in Version 5.5 and 5.6 I think. I initiated a discussion about it. The result was that the driver should be integrated again. I dont know if this is in 5.7 really the case.Look if you have in the path like C:\Qt2\5.6\msvc2015\plugins\sqldrivers
the qsqlodbc files. -
Hello @rockon209,
oh I am happy :-)Now your Problem:
It must work ! I use it since 1 year.We must find the error systhematic.
First you should try a connection via the windows Windows-ODBC tool.
I there is something wrong we must not look on Qt.