I am trying to use ODBC driver in one of my Qt5 project.
I compiled QODBC driver and copied the driver dlls to the Qt\Qt5.0.0\5.0.0\msvc2010\plugins\sqldrivers folder.
When I try the following code:
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
I get the following error:
QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3
Same error is encountered if I tried loading QODBC3.
Even though QODBC and QODBC3 drivers are present, Qt still could not load QODBC driver.
I am running Windows 7 (64 bit) PC.
Has anybody encountered such error? Any clues on what might be wrong ?
I found the issue was caused due to incorrect Visual studio versions used while compiling odbc sql driver.
I had both VS 2008 and VS 2010 in my computer. My Qt5.0 was using VS2010. But when I compiled the odbc sql driver, I had used VS2008. And that caused the problem.
Qt was able to detect the sql odbc driver but could not load it.
I solved this by recompiling the odbc driver using VS2010 and odbc driver works pefectly.
Here are the steps to compile and use sql odbc drivers in Qt 5.0
open qt command prompt:
this can be found in start menu under Qt
set vc++ environment variables:
To do this , cd into to the C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ folder and run vcvarsall.bat
Important point to note is, compile the driver using the same version of Visual Studio thats used by Qt.
cd into \Qt5.0.0\5.0.0\Src\qtbase\src\plugins\sqldrivers\odbc source folder
qmake odbc.pro
nmake
If it runs correctly, the compiled qsqlodbc.dll and qsqlodbcd.dll
will be available in \Qt5.0.0\5.0.0\Src\qtbase\plugins\sqldrivers folder.
While deploying qt based application, qsqlodbc.dll (release version) need to be copied to sqldrivers folder.
Related
I created a application in linux and now I am trying to import this application to windows which is 64-bit. I installed Qt creator(64-bit) and imported the project.I am using certain libraries like omniORB4 which are built on 64-bit.Now when I try to build the application I get the following error:
module machine type 'x64' conflicts with target machine type 'x86'
Qt Version : Qt 5.3.1 (MSVC 2013, 64 bit)
Visual Studio :2010
When I imported the project in Qt on windows there was a option to configure the project and it showed only " Microsoft Visual C++ Compiler 10.0(x86)" in the options. I think I am getting this error because my compiler is x86. there are few other compilers which are shown in Project Properties but when I select them it gives me a error. Is there any way that I can change my compiler to x64 in QT and what are the other options that I can follow to resolve this issue. I looked into many links but still no luck.
I try to write a program in Qt Creator using db library. When i run my application in Qt Creator, i get that error: "QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE"
The qsqlodbc.dll and qsqlodbcd.dll files exist in the plugins/sqldrivers folder of the Qt 5.1.0 installation.
Why can not it find the driver altough it exits in the default installation?
Thanks
Currently, I am trying to retarget my windows store app to windows 8.1 preview. The problem is, that I used sqlite-net package in one of my project. I followed steps described here:
http://www.lyalin.com/2013/07/09/sqlite-for-windows-runtime-for-windows-8-1-apps/ and downloaded pre-release version of sqlite visual studio extension from this link:
http://www.lyalin.com/2013/07/09/sqlite-for-windows-runtime-for-windows-8-1-apps/.
I have added a reference to a newly installed sqlite for windows runtime in my project, but I got an error while building:
Error 2 Windows Runtime type 'Windows.Foundation.Point' was found in
multiple referenced winmd files. Please remove either 'C:\Program Files (x86)\Microsoft
SDKs\Windows\v8.1\ExtensionSDKs\Microsoft.VCLibs\12.0\References\CommonConfiguration\neutral\platform.winmd'
or 'C:\Program Files (x86)\WindowsKits\8.1\References\CommonConfiguration\Neutral\Windows.winmd'
from the list of referenced files. C:\Users\Jarosław\Desktop\BCM\Win8Client\MetriceModel\WINMDEXP
MetriceModel (Windows 8.1)
Somewhere, on one of the forums somebody hinted, that if you remove reference to microsoft visual c++ runtime package from the project, it will solve the problem. After I did that whole solution compiled fine, but I got a following exception at runtime:
Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Exception is thrown at a line:
#if NETFX_CORE
SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
#endif
of SQLite.cs file (file is from mentioned earlier sqlite-net package).
Project's folder bin/Debug/AppX contains file sqlite3.dll. Every project in my solution has x86 as a platform target. How do I fix this issue? Before migrating the project everything worked fine.
You must install the official version of vsix package on sqlite download page (v3.8.0.2).
In the Visual Studio Add-in manager, this package version is 3.7.1.17 and it's not correct.
After, i think it is a bug, you have to select the good processor (platform target).
I had the same error because I deployed a migrated winrt application (8.1) compiled in x86 on a x64 machine...
=> in windows 8.0 it works, but not in windows 8.1.
If you have a x64 machine you have to select the x64 target compilation. I hope it will be fixed in futur...
can you please re-install the preview of SQLite for WinRT 8.1? There was an issue with the initial package, but we worked with them to update. http://sqlite.org/download.html
If you have an exception with
SQLite3.SetDirectory(/*temp directory type*/2,windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
Check if your project uses x86 and not any CPU
I cannot Debug with the old Qt 4.8.0 psql driver. And the new Qt 4.8.1 psql driver cannot be loaded..
[ListAvailableSQLDrivers : [0mPluginsPath() C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\plugins
[ListAvailableSQLDrivers : [0mQSqlDatabase::drivers() QSQLITE
[ListAvailableSQLDrivers : [0mQSqlDatabase::drivers() QODBC3
[ListAvailableSQLDrivers : [0mQSqlDatabase::drivers() QODBC
I'm working with QtSDK 1.2 (Qt 4.8.1), Win7 64bit and PgAdmin 1.14.3
My QT c++ software can load the old psql driver from Qt 4.8.0:
C:\QtSDK\Desktop\Qt\4.8.1\msvc2010\plugins\sqldrivers,
qsqlpsql4.dll,
qsqlpsql4d.dll
I've tried to compile the psql driver from the Qt Sources. That worked partially. On my laptop, the compiled driver cannot be loaded, but on the laptops of my buddies this driver is working. We all have Win7 64bit. Any ideas how to track this down are welcomed.
thanx QtDeveloper
I'd recommend not to mix Qt-dlls of one computer with plugins built/installed on another.
Qt stores default paths of plugins in Qt-dlls and the paths provided during compilation/installation on different computers may differ.
Try to use procmon from sysinternals, and see during the start of the process which paths the app tries to open while seatching for the plugins.
Try to copy \plugins\sqldrivers* to <YourAppStartPath>\plugins\sqldrivers
I have installed ‘Qt Creator 2.4.1 Based on Qt 4.7.4 (32 bit)’ on Windows 7 with Visual studio 2008. But on creating the basic project am getting following error :
c:\qtsdk\desktop\qt\4.8.1\msvc2008\mkspecs\win32-msvc2008\..\win32-msvc2005\qplatformdefs.h:67:
error: C1083: Cannot open include file: 'windows.h': No such file or directory
Also I checked the windows.h its present in following location : C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\
I would like to mention that I can’t use the MinGW target due to project specifications.
Requesting everyone to help me out of this situation.
in Qt Creator, Tools--Options, Build&Run, Kits, choose a kit and edit its attributes, change the Compiler from "Microsoft Windows SDK ..." to "Microsoft Visual C++ Compiler 9.0 (x86)".
I solved the same problem by this way.
Check Qt creator's Projects/Build Environment and edit variables
(INCLUDE, LIB, OSINCLUDES, OSLIBRARIES, PROGRAMFILES, SDKDIR, SDKTOOLS, WINDOWSSDKDIR)
that contains Windows SDK 7.1 path(C:\Program Files **(x86)\Microsoft SDKs\Windows\v7.1**).
Maybe Windows SDK 7.1 is installed at "C:\Program Files\Microsoft SDKs\Windows\v7.1"