Unsolved Qt 5.6.0 no odbc driver availabe - please vote for this bugfix
-
Hello,
I am on the way from Qt 5.5.1 to Qt 5.6.0, use MSVC2013.
The program runs with the old version fine but with the new Qt I get no ODBC driver.bool ok=QSqlDatabase::isDriverAvailable("QODBC"); if(!ok) { ErrorMsg="No ODBC driver available!"; return 1; }
Whats the problem ?
Here is the vote for the bugfix:
https://bugreports.qt.io/browse/QTBUG-49420 -
Hi, I also miss it (have several apps that depend on it) but it seems the ODBC plugin is not popular enough to ship, here it's reported as a bug
The solution is to download Qt's source code and build it yourself. -
Hello @hskoglund,
not popular ? What is an alternative way to connect to a MS-Access-DB with Qt ?
Damned, Qt changed from version one version to another, no more usable.
I would classify it as a clear bug to leave such a important deployment!Building Qt from source - did you have ever success with it. Is there a make switch to enable ODBC ?
-
Hi, well the kosher way is described here , basically download Qt's source code and build just the plugin.
But since I am a lazy person I opted for the more hazardous route of binary patching Qt's 5.5.1 version of qsqlodbc.dll, works fine for me (it seems so anyway :-)
So here's what I did:Note: Warning! What I am describing here is NOT supported or recommended:
- Copy qsqlodbc.dll from the 5.5.1 ..\plugins\sqldrivers directory into your 5.6. ..\plugins\directory
- Using your favorite hex/binary editor, locate the 2 consecutive bytes at 0xE65 and 0xE66 picture here
- Change them from 01 05 to 00 06 another picture here
- Save and voila!
-
Hello @hskoglund ,
wow indeed it works.
I found for the debug-dll one must change the second occurrence of 0105 at FACB.I hope this will be fixed in the following Qt version(s) and there is no general decision to leave it. I think this trick will not work forever. Please let it in !!!
ODBC is important for a lot of people I think. Without it Qt would be no more usable for me.
Thank you very much for the quick help !!!! -
@Andy314
hi, u should go and vote for it.
To make it important.
Else it will most likely not be included ever again. -
Hi @mrjj ,
vote the messages in thread or what do you mean ? Can I vote for features ? -
@Andy314
hi
if u look at the
https://bugreports.qt.io/browse/QTBUG-49420
to the right. there is vote.
So if u login/make account. u can vote on issue/bug.
If many vote for it, it does get more attention.
so far its
Votes: 3 Vote for this issue -
As a rookie in QT Forum,I have to say it's nervous to reply to my first comment.
Now I'm faced with the same question:No OBDC drive for the sql database.But I am not too conscious of the configure code:
cd %QTDIR%\qtbase\src\plugins\sqldrivers\odbc
qmake odbc.pro
nmakeI mean,not only I don't know its meaning ,and** more important,I don't know where to use it??(copy and paste it on the pro file which in your project?or some place else?)**Forgive me I am not too practical of QT,all I learned during my college life is 48 hours C++...
And I am not sure it's the right place to ask for help,and I don't know how to insert a picture in my comment(hyperlink???)...
-
@MartinChan
Hi and welcome
Don't be nervous. we are very friendly here.
You will do it a cmd prompt/Shell
(start, type cmd , it shows command prompt)
If you are using visual compiler, it should be its cmd prompt version.lets see
cd %QTDIR%\qtbase\src\plugins\sqldrivers\odbc
this will go to the odbc directory
type dir and check there is the odbc.pro
and then you build the odbc driver.If it dont know qmake, you might need to add to PATH the location of qmake.exe.
You can upload images to say postimage.org or other places. there is no direct upload here.
Update:
You can also open odbc.pro in Creator. That might also just work. -
@mrjj
Wow,awesome reply speed~I will try it soon and wish it work~~;)~You're very nice~~~~Another question:I am not sure about the relationship between the Qt and its opensource file:Before this question , I just use the Online Installer that Qt.io provided(MSVC2013,64bit),but in this case I found no QtBase folder under MSVC2013_64 folder,so I have to download the whole qtbase opensource...But this progress really confuses me:Is Qt just provided separated open source to people for choice? (@_@;)
Maybe it's time to reinstall the QT again...=.= -
@MartinChan
Hi
Using the installer, there is also option to install the source code.
There is a maintenance tool. I think you can get the source running that and add it.Since you took the MSVC2013 Qt, I assume you have visual studio Installed ?
(already) -
Yes~I already had installed VS2013~
FYI:Users in China can't use the postimage.org (@ @),but luckily we can have other similar websites like this.Haha~~~
-
@MartinChan
Ok. super.
Im not visual studio user but I recall it having its
own command prompt with all paths setup.
You should do the command in that one.Oh, thats odd. postimage.org is not really dangerous but I guess
there can be many reasons :) -
@mrjj
Final worked!!!Here is the pic.Although it still has some other problems ,but no more"QODBC driver is not available"makes me feel really good~~I really want to share the way I use to solve this problem(all of you know due to Qt is an open system so it changed all the time ,but I really want they add ODBC to it in the next version!)Here is the way to do with Qt5.6 and MSVC2013(64bit):
-
First,make sure you have download the qt version includes the whole opensource(or you can download it separated maybe ,I didn't try it)what else ,add the PATH(This word prepared for the rookie like me) of your qt.
-
Second,open cmd and type cd %QTDIR%\qtbase\src\plugins\sqldrivers\odbc
to get the folder includes odbc.pro file .
(Make sure the PATH thing)then type qmake odbc.pro -
Here comes another thing ,u must call the vcvarsall.bat(or vcvar32.bat) to make the nmake,here comes the question:where to find this bat file?Commonly it's your Microsoft Visual Studio 2013\VC folder ,like my computer,it's D:\Visual Studio\Visual Studio2013\VC.So don't forget to execute it before the first step,then u can make the nmake(I copy this bat file to the odbc.pro's folder,I didn't know if it has the impact. )
-
The you can find Qtbase\plugins has created a new sqldriver folder,copy all the things in it to the C:\Qt\5.6\msvc2013_64\plugins\sqldrivers (namely your compiler folder and the sqldrivers folder under it ),then ,real Done.
FYI:Thx for the people in this topic,especially @mrjj ,I really get a good feeling about that,haha~~
-
-
@MartinChan
Good work! :) -
Hi, is anyone still here? I ran into the same problem, but it can't be solved by the method posted here. It went well when use
qmake
, but when usenmake
, some error happened. Can anyone help me? I also post my question in this link with a screen shot. -
First,sorry for not clearly clarify the first step.
The first is to execute the vcvarsall.bat(or vcvars32.bat,according to the version you installed)to make sure you can use nmake lately.So what you do first is like:
cd directory_of_your_vs_vc/vcvarsall.bat(vcvars32.bat may under the bin folder)
after that you can use nmake and nmake install orider.
-
@MartinChan
I tried both and neither of them work..., the same error came out when applying them. -
@Leo-Z awkward it didn't work,but nmake is the order related to the VS,i don't know if it is influenced by your environment config,maybe you can post a pic to show what vc folder have and the error when you configure.