Connecting to SQL Server using PyQt - qt

How can I use Qt to connect to a SQL Server (developing on a Mac)
I've been trying to first follow this guide to install the ODBC driver but its just not working http://doc.qt.io/qt-5/sql-driver.html#qodbc
On step 2 it says to run
qmake -- ODBC_PREFIX=/usr/local/unixODBC
I've actually changed that path to point to a fresh download of unixODBXC
qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7
The output from that ends up being
Running configuration tests...
Done running configuration tests.
Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt is now configured for building. Just run 'make'.
Once everything is built, Qt is installed.
You should NOT run 'make install'.
Note that this build cannot be deployed to other machines or devices.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
Then when I run make sub-odbc I get
> make sub-odbc
make: *** No rule to make target `sub-odbc'. Stop.
export PATH=$PATH:/Users/userx/Qt/5.12.0/clang_64/bin
cd /Users/userx/Qt/5.12.0/Src/qtbase/src/plugins/sqldrivers
qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7
make sub-odbc
I'm following this exactly as instructions but it doesn't seem to work, any pointers or suggestions?

I know it's pretty late, but try
export PATH=$PATH:/Users/userx/Qt/5.12.0/clang_64/bin
cd /Users/userx/Qt/5.12.0/Src/qtbase/src/plugins/sqldrivers
echo "" > config.cache
echo "" > config.log
qmake -- ODBC_PREFIX=/Users/userx/Downloads/unixODBC-2.3.7
make sub-odbc

Related

MySQL Connector/C and MySQL Connector/C++ does not work with QT

I have QT5 installed and I want to install QMYSQL. So I followed this manual. It's seems very simple, but still, nothing happens.
https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows
First I have %QTDIR% working and I have installed MySQL Server 8.0 64-bit with MySQL Connector/C++. I also downloaded MySQL Connector/C and then I run the following commands.
MySql .................................. no
As you see. Non of them understand that MySQL is installed. Why?
Here I'm trying with MySQL Connector C 6.1
C:\QT\5.12.11\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"
Running configuration tests...
Done running configuration tests.
Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... yes
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt is now configured for building. Just run 'mingw32-make'.
Once everything is built, you must run 'mingw32-make install'.
Qt will be installed into 'C:\QT\5.12.11\mingw73_64'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
Here I'm trying with MySQL Server 8.0
C:\QT\5.12.11\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:\Program Files\MySQL\MySQL Server 8.0\include" MYSQL_LIBDIR="C:\Program Files\MySQL\MySQL Server 8.0\lib"
Running configuration tests...
Done running configuration tests.
Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... yes
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt is now configured for building. Just run 'mingw32-make'.
Once everything is built, you must run 'mingw32-make install'.
Qt will be installed into 'C:\QT\5.12.11\mingw73_64'.
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
C:\QT\5.12.11\Src\qtbase\src\plugins\sqldrivers>
Solution: Just paste .dll files everywhere.
https://www.youtube.com/watch?v=qeErME39zvw&ab_channel=JanN.
https://github.com/thecodemonkey86/qt_mysql_driver

Appveyor - Compiling static qt5.10 application (with openssl and qml webview)

I'm trying to set up autobuild appveyor on my Qt project.
My app is using qt5.10.1, with qml and openSSL features.
I'm lost... I didn't know from where to start :/
# 1:
I found some examples of .apveyor.yml config files, but they are all using mingw32 compilator which do not allow me to use qml webview module (why)... I didn't find what I have to write in my appveyor config file to compile my app with msv2017 where is the compilator ?
Actually, my appveyor.yml looks like that (I try to do as QtCreator is doing on my local computer but it's not working)
image: Visual Studio 2017
branches:
only:
- master
install:
- set QTDIR=C:\Qt\5.10.1\msvc2017_64
- set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
build_script:
- qmake app/QRegovar.pro -spec win32-msvc
- qmake_all
- C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
deploy:
- provider: GitHub
artifact: C:/projects/qregovar
draft: true
prerelease: false
on:
branch: master
appveyor_repo_tag: true
And it's failling with the following error:
Build started
git clone -q --branch=master https://github.com/REGOVAR/QRegovar.git C:\projects\qregovar
git checkout -qf 7357eb2adab349c4de9e0b346dc99027964ea5a5
Running Install scripts
set QTDIR=C:\Qt\5.10.1\msvc2017_64
set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
qmake app/QRegovar.pro -spec win32-msvc
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?
Command exited with code 3
# 2:
I'm also wondering if appveyor is using qt static build ? As I would like to create "ready to use" package for the user ?
I'm using CMake, but I guess the trick is to setup 'cl' compiler into PATH, so qmake is able to find it.
In sample appveyor scripts the main build script is '.\qtmodules-travis\ci\win\build.bat'. This script will check/use AppVeyor matrix-defined variable for platform (line 7+) and then the script define VC_DIR etc.
And on the end is invoking script referred by you 'build-msvc.bat' where is invoked:
call %VC_DIR% %VC_VARSALL% || exit /B 1
QtCreator will do the setup for you (you are using Kits...)
When you are building in clean command line, you should do 'vcvarsXXX.bat call yourself before 'qmake' call.
In my opinion AppVeyor doesn't trigger this call for you, because developer may wish different build env. setup (e.g. x86, x64, arm etc.). It's your choice. Actually this is the hint as well when you start 'Qt command line' on your PC from start menu (it call 'C:\Qt\5.11.0\msvc2017_64\bit\qtenv2.bat' shell setup script)

Running Qt application under wayland

Running:
./myapp -platform wayland
gives:
This application failed to start because it could not find or load the
Qt platform plugin "wayland" in "".
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl,
offscreen, vnc, xcb.
Reinstalling the application may fix this problem. Aborted (core
dumped)
Following the instructions: How to build qtwayland?
Running qmake gives:
Running configuration tests...
Done running configuration tests.
Configure summary:
Qt Wayland Client ........................ no
Qt Wayland Compositor .................... no
Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
The qtwayland README indicates 2 dependencies:
xkbcommon 0.2.0 - http://xkbcommon.org/
wayland 1.6.0 - http://wayland.freedesktop.org/
On fedora 28, libxkbcommon is installed by default. In addition I also installed libxkbcommon-devel
dnf whatprovides *wayland*
returns no results, although my gnome session is running under wayland.
I see I can download wayland from https://wayland.freedesktop.org/releases.html.
I downloaded and decompressed 1.15, but not sure what to do with decompressed source: do I build it? do I need to put it somewhere where qtwayland can find it?
I see that the following file exists by default in fedora 28:
/usr/lib64/qt5/plugins/wayland-graphics-integration-server/libwayland-egl.so
But copying it to ~/Qt/5.10.1/gcc_64/plugins/platforms
does not resolve my application startup errors.
Question: how to get my Qt application to run under wayland?
Added in response to bobbaluba questions below:
Am trying to build QtWayland against the official Qt Binaries because it is not included.
Installed wayland-devel as suggested, but qmake still reported no configure for Qt Wayland Client, as per the message above.
Tried to install qt5-qtwayland using dnf, which reported:
Package qt5-qtwayland-5.10.1-2.fc28.x86_64 is already installed, skipping.
The following might be relevant:
? sudo dnf whatprovides libwayland-egl.so
Last metadata expiration check: 0:18:44 ago on Wed 09 May 2018 09:15:20 PM +08.
qt5-qtwayland-5.10.1-2.fc28.i686 : Qt5 - Wayland platform support and QtCompositor module
Repo : fedora
Matched from:
Provide : libwayland-egl.so
? find / -name libwayland-egl.so* -print
/usr/lib64/libwayland-egl.so
/usr/lib64/qt5/plugins/wayland-graphics-integration-server/libwayland-egl.so
? sudo ldconfig -p | grep wayland-egl
libwayland-egl.so.1 (libc6,x86-64) => /lib64/libwayland-egl.so.1
libwayland-egl.so (libc6,x86-64) => /lib64/libwayland-egl.so
Installed Qt 5.11.0rc which resulted in
~/Qt/5.11.0/gcc_64/plugins/wayland-graphics-integration-server/libwayland-egl.so
~/Qt/5.11.0/gcc_64/plugins/wayland-graphics-integration-server/libwayland-egl.so.debug
being added to ~/Qt/5.11.0/gcc_64/plugins/platforms.
cmake's CMakeFile.txt suddenly stopped working when I installed Qt5.11rc - with gcc unable to find Qt headers like QDate.
Tried compiling the example project 'addressbook' using Qt5.11 and got:
QSocketNotifier: Can only be used with threads started with QThread
Using Wayland-EGL
Using the 'xdg-shell-v6' shell integration
In short, using the Qt5.11rc seems to resolve the issue.
Why does configuring QtWayland fail?
I'm assuming (correct me if I'm wrong) that you are trying to build QtWayland against official Qt binaries that do not include QtWayland.
Do you have development packages installed? In your case I think it should be wayland-devel.
Btw, the libwayland-egl.so you see, is your distro's version of the qt wayland-egl buffer integration (and not the same as the libwayland-egl.so dependency which qmake complains is missing). However, you should still be able to build QtWayland without wayland-egl, so I'm not sure what this is about.
Other options:
1. Use official QtWayland binaries
You are probably running into this problem because Qt packages did not previously include QtWayland.
However, starting with Qt 5.11.0 the official Qt binaries should include QtWayland, so the easiest thing would probably be to install Qt 5.11.0 or newer.
2. Use the distro's version of Qt (and Qt Wayland)
Install and use Qt from the distro, make sure you also install qtwayland (on Fedora I think it's qt5-qtwayland).

sqlite odbc silent install

How to Silent install sqlite odbc driver ?. Found here http://www.ch-werner.de/sqliteodbc/
i found 2 methods to connect to sqlite one is above and the other one is dhSqlite(vbRichclient4.dll,vb_cairo_sqlite.dll and DirectCOM.dll). which is a class library and replacement for ADO it seems for sqlite. but i could not find any documentation for this one.
i like sqliteodbc because it just works with ADO. but dhsqlite can be installed along with the app. Also dhSqlite contains the sqlite3 engine also i suppose. is it true?.
Could you suggest which one i could follow? or is there any other option i could check?. I am looking for it to be a silent install or install as
part of my app. itself; free and supported for vb6
Thanks
If you use Inno Setup for distributing your application and use sqliteodbc 0.9996 version, we can add script like this:
[Files]
Source: sqliteodbc0.9996.exe; DestDir: {tmp}; Flags: deleteafterinstall
[Run]
Filename: {tmp}\sqliteodbc0.9996.exe; Parameters: /S; StatusMsg: "Installing SQLite ODBC Connector..."
Win32 install/remove/shell by RUNDLL32
Each driver DLL provides entry points for ODBC driver installation
and removal which can be invoked from RUNDLL32.EXE, eg
### install sqliteodbc.dll
C:> rundll32 [path]sqliteodbc.dll,install [quiet]
### remove sqlite3odbc.dll
C:> rundll32 [path]sqlite3odbc.dll,uninstall [quiet]

unable to update sqlite3 on mac osx?

i want to install newest sqlite3 on my mac osx. i am trying this from last 6 hours but still not succeed.Here are the steps i have followed.I have tried this site
mkdir ~/src
cd ~/src
curl http://www.sqlite.org/sqlite-3.6.18.tar.gz | tar zx
cd sqlite-3.6.18
autoconf
./configure --prefix=/usr/local
make
sudo make install
//check what version of SQLite is installed
sqlite3 --version
3.6.18
which sqlite3
/usr/local/bin/sqlite3
but it fails
but i manually downloaded the sqlite3 from the address below
http://www.sqlite.org/sqlite-amalgamation-3.6.22.tar.gz
and then tried the above scriot
the description of the above link is
A tarball containing the amalgamation together with an configure script and makefile for building it. This is the recommended source distribution for all Unix and Unix-like platforms.
and i have also downloaded the
Precompiled Binaries For Mac OS X
sqlite3-3.6.22-osx-x86.zip
A command-line program for accessing and modifying SQLite version 3.* databases. For x86 Macs running Leopard (OS 10.5) only.
but still i am unable to install.I have also read that modifying the default sqlite3 will cause some application stopped working because apple has a modified version of sqlite.
does some one knows how do i install the new sqlite3 and use that without removing the default one.I am not familiar with terminal commands.
ok here is an update
i have installed the sqlite in a new folder in /users/admin/sqlite3new
but when i run sqlite3 from terminal it shows older version...
also if i directly executes the bin file i am unable to open database is there any other way to open database?
Thanks
Macports ships a version of sqlite3 that will probably work perfectly fine (and it installs your dependencies automagically). Maybe that's an option for you?
Macports by default installs software in /opt so it will not remove the 'default' sqlite.

Resources