Problems with Qt Sql drivers - mysql

I have the following strange situation here I need some help with:
I am building a Qt application with MySQL access. For this I have:
- a dedicated building machine, using Qt 2010.05 and a MySQL 5.1 just for the libraries, Windows 7 32 bit. This machine creates the install package.
- a dedicated development machine, CentOS 5.5
- two testing machines:
- - an "always" fresh install of Windows 7
- - another Windows 7 machine with a newer Qt on it used for other stuff too.
I have built the previous version of the application sometime in February this year (on the bilding machine), it works nicely and perfectly, loads the MySQL driver (I have put it in the sqldrivers directory as indicated by everyone else). The install package installs, works everywhere (at least on all my Windows machines).
Now, I have built another release of the application, on the same machine. In the install package the only important difference is the executable (and some HTML files, but those are not relevant). Everything else is the same. When I run the NEW executable on the build machine I get ("QSQLITE", "QMYSQL3", "QMYSQL", "QODBC3", "QODBC") as the QSqlDatabase::drivers() output. If I run the NEW exectuable on any other machine I get an empty list of drivers. If I run the OLD package on any machine it works...
The loaded modules by the two processess (old executable, new executable) are basically the same, except is the qtmysql DLL which gets loaded in the old one and not in the new.
Have you ever encountered a situation like this? If yes do you have a feasible solution for it?
Thanks,
f.

Qt will only load plugins which are compatible with the program or version of Qt used. See the Deploying Plugins document.
You could also try using QPluginLoader to manually load a plugin and check what is reported as the QPluginLoader::errorString when it doesn't load (add the error message to your question if you can't fix it still).

Related

Deploy Qt MySql Application

I'm working on Win10 64bit with Qt5.10.1, VS2017, MySql 8.0(64it). Everything is fine in my computer. After I deploy my application on other computers, a error message "Driver not load" pop up.
I have checked many forums including two posts in stackoverflow, [Qt][QMYSQL] Deployed app - Driver not loaded
Deploying qt mysql application
But it doesn't work for me. The following are the dll files in my folder:
qsqlmysql.dll is included in the folder sqldrivers.
All of the platform, software, SDK are 64 bit. can anyone help me? thanks.
Thanks everyone who answer my question. I tried many methods and almost give up. I never used MySQL before and this time I choose the newest MySql 8.0.12. I ignore the procedure and post the solution directly:
Beside libmysql.dll and qsqlmysql.dll, other two *.dll files are also necessary (but no solution I searched refers to them): libeay32.dll and ssleay32.dll, they are located at MySql/bin/. For my computer, they are contained in the system path, while for other computers that do not install MySql, they lack these two. Thus, we need to copy them to the package as well.
For anyone who encounter the same problem, for example using the newest MySql 8.0, you can try this method.

Dart Pub serve won't start

so I re-installed all my dev tools on a system and moved my entire project folder into it. I'm getting an error even before I open the dart editor.
when I run Pub Serve in terminal I get a
bad state: subscribing to a closed stream
or an equally confusing
Can't find pubspec.yaml
No idea why... since the exact same layout worked on a different machine.
Similarities
both machines run Windows 7
both machines have the same version of the Dart SDK and editor
both machines are 64bit (and are running the appropriate tools)
Differences
the machine not working is an Intel where the other is an AMD
the machine not working has all its Windows updates (not saying windows updates cause problems... just that problems almost always occur after updating)

How to fix 'Managed SQL Server Installer has stopped working'

I am trying to install SQL Server 2008 Enterprise Edition on Windows Server 2008. I have done all the process till the Installation correctly. However, the installer displays the message "Managed SQL Server Installer has stopped working".
No online Solution has been provided yet....
Anyone sorted this problem before?
This is usually a problem with your installation of .NET framework. E.g:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/34671131-a095-4068-b4d8-ab5ef6f5b8cc/managed-sql-server-installer-has-stopped-working
Check that your installations are all in working order by using the tools on this site:
http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx
You may have to re-install any or all of your .NET framework versions.
Instead of trying several methods that have not been approved, it is better to repair the MSSQL Server installation. On the other hand, there is some other issues that can be encountered during the repair process i.e. Installing the .NET Framework 3.5 on Windows 8, Windows 8.1 and Windows 10 as shown below.
In this case, if you have trouble during .NET Framework installation, you can install it by following the steps below (requires Windows 8, 8.1 or 10) setup disc or ISO file):
1) First you'll need to copy Windows 8 setup files to your hard disk. If you have Windows 8 setup ISO copied in your system, you can mount it by right-click on it and select "Mount" option or you can extract its content using 7-Zip.
If you have Windows 8 setup disc and don't want to copy its content, its ok. Just insert the disc in your CD/DVD drive so that Windows can access its content.
2) Now open Command Prompt as Administrator as mentioned here and then provide following command:
Dism /online /enable-feature /featurename:NetFx3 /All /Source:F:\sources\sxs /LimitAccess
Here "F:" represents the CD/DVD drive letter in your system which contains Windows 8 setup disc. Replace it with the correct drive letter according to your system.
If you extracted Windows 8 setup files in a directory, replace F:\sources\sxs with the correct path.
3) As soon as you execute the above mentioned command, Windows will start installing .NET Framework 3.5 in your system and it'll not require Internet connection.
It'll take a few minutes and you'll get a message that the operation completed successfully.
4) That's it. Now you have installed .NET Framework 3.5 in Windows 8 without using Internet connection.
For more information have a look at How to Install Microsoft .NET Framework 3.5 Offline in Windows 8 and Later without Internet Connection?. Hope this helps...

Open Source Application Server Solution

A project with the following technologies and components has surfaced: to up a Web stack solution initially composed with Ubuntu, JDK, JBoss, Spring MVC 3.0+, and MySQL.
In planning this project, I have been struggling to find answers to the following questions for first steps, best practices, and sequence:
1) Does the JDK (and JBoss) need to be installed as ‘root’? (I have seen articles that mention it is not a good idea to operate in root unless absolutely necessary due to the fatal consequences.)
2) Does Ubuntu need to be installed as a Server in order to accomplish all this, or can it also be installed as a Desktop? I have not been able to determine if having a JBoss and MySQL need to be installed on top of Linux as a server.
3) Does Maven need to be used within Spring STS in order to get JBoss, and MySQL (and in the future Hibernate) to work successfully together?
4) My intent is to install in this order: a) Ubuntu -> b) Java -> c) JBoss -> d) Spring STS -> and e) MySQL. Are there any blatant conflicts in this sequence?
JBoss will require Java (recommend Java 7) before it will do anything. I don't think it really "installs" per-say, but rather just unpacks to some directory (even if you install from the package manager, it just really extracts itself). I question your need for Spring since JBoss and Java EE in general really does everything Spring does, and better now-a-days. Unless you have a specific requirement for Spring, I'd question this extra dependency.
For linux - in a high level, any OS can be a "server", all it needs is to be capable of serving things (web pages, ssh connections, etc). In M$ world, different "levels" of the OS have been specially designed based on anticipated task/workload. So for example, while Windows 7 can indeed run as a server, it was not designed for it and therefore may not be optimized or include helper utilities and tools to make life easier as a sys admin of the system. Windows Server on the other hand does include all the "normal" server tools and lots of goodies to make maintaining and setting the server up easier.
In linux land, this is no such thing. Linux is the kernel that talks back and forth with the bare metal, etc... and Distro makers will take that and build an OS around the kernel, basically just attaching any packages they feel their distro needs... such as wget, or cat, or any other standard userland apps, plus some non-standard such as mysql or java or whatever they want.
Now, some distributions of linux will tailor themselves at being "server" ready, while others will tailor themselves at being a desktop OS. The difference? It's really just whatever default packages the distribution maker decides to include or not. For example, the overwhelming majority of linux servers are run completely headless, and therefore there is absolutely no reason to have X11 and a huge bloated GUI environment installed and/or running on that system... it's pointless. Also, an "average joe" user does not need MySQL installed by default on his desktop system since it would only bloat his system and he likely won't ever use it.
So basically it comes down to default installed packages.
Some linux server distros take this further and exercise extreme caution when making updates, patches, or new releases in the name of stability and security, while on the other hand most desktop distros are more haphazard with their updates since if it breaks a home users web browser, it's probably not a huge deal... but if a server update breaks the webserver application stack, now that's a serious problem.
So you'll find server OS's like CentOS (based on upstream RHEL) are extremely slow to bring in the "latest and greatest" features that desktop OS's get early on. Their goal is high security and long term stability.
Now, for Ubuntu. While I certainty know a lot of folks run Ubuntu as their server OS choice (partly due to Amazon choosing Ubuntu as the default linux VM for their ECS cloud), but I'd really question this. Ubuntu is not focused on being a server. It's focused on being a great all-around desktop oriented OS. Yes the LTS version is meant for long term stability, but it's based out of a desktop OS, so it's still not the focus.
IMHO, I'd go with CentOS because it's free and completely binary compatible version of RHEL - and RHEL is the de-facto standard for enterprise-grade linux servers. Be aware though, the RHEL way of doing things is a bit different than the debian way -- so there is no apt-get, you must use yum install instead. Startup scripts are different and some ways of doing things are different, but really, once you know linux, you know linux.
EDIT: Also check into Jenkins - its a free opensource continuous integration system that runs on JBoss or Tomcat or any other container, and can automagically pull your code from a repo (github, git, svn, etc) and compile/package it then push it to live deployment. You setup your ANT or Maven build scripts, and it can kick off on a schedule or however you configure it.
EDIT EDIT: I'd also recommend using OpenJDK -- as it's likely included in your package manager (for just about every disto) and will be more updated than the oracle version if it's in your package manager too. I've found most "server" distros will have OpenJDK 7 while only having Oracle java 6 in their package managers. Also, installing it via the package manager will enable you to keep it updated a ton easier.
Installed as root, why not? Run as root, probably not a good idea.
If you want a desktop, install a desktop distrib. If you want a server, install a server distrib. This doesn't change what can and can't be run in the OS. It only changes what is installed by default.
Maven is a build tool. JBoss doesn't care how you build your app. All it cares about is if the application you deploy is a valid Java EE application.
No. You need an OS, so Ubuntu must come first. JBoss and (AFAIK) Spring STS need a JRE to run, as they're Java applications, so Java should be installed before them. MySQL is independent of JBoss, STS and Java, so you can install it whenever you want.
Note that if you're struggling just with this installation part, be prepared to suffer with the rest. Building a Java EE webapp is not a piece of cake, and you should probably find some experienced developer to help you, as it seems you're only beginning with Java.

MySQL not connecting in QT application

I'm working on a database-driven QT project (basically a journal/diary tool) that will eventually allow users to connect with MySQL, SQLite, and Postgres. For now, only the MYSQL module is built, but i'm having problems making it work on Windows.
I'm compiling against a static-built QT 4.7.4 library on windows 7, and this allowed the program to find the QMYSQL driver properly. I know this because I'm not getting the "QMYSQL driver not loaded" error when I build everything staticly. However, when I try to connect to the database, I get "QSqlQuery::exec: database not open" errors. At first, I thought this was because the remote database wouldn't accept connections from my address, but I couldn't connect to localhost (as root, with the correct password) either.
I know the application code is good because it works perfectly on Linux (Same QT version, non-static build... it seemed to "just work" when built on Linux without any extra steps) so I'm wondering if QT is built correctly on Windows. I wrote a batch file to automate the build process:
TITLE Build QT 4.7.4 (static)
ECHO ON
cd C:\qt-4.7.4\
path C:\MinGW\bin
configure.exe -opensource -platform win32-g++ -release -static -qt-sql-mysql -l mysql -I C:\include -L C:\lib
PAUSE
mingw32-make
PAUSE
Am I building QT correctly on Windows? When I first experienced this problem, I followed these instructions: http://rag.com.au/linux/qt4howto.html but it still wouldn't work after the most recent build.
I had to build QT staticly because without that my application couldn't find the QMySQL driver. At first, I tried using the includes/libraries from the MySQL 5.5 community edition, but the build failed about halfway through for some reason. (It didn't like something about that particular libmysql.lib) When I tried using the headers/libs I compiled against in Linux, the build finished properly, but I'm getting this problem now.
Does it matter where the Headers/Libraries are stored when QT is compiled?
Also, I have a triple-core CPU. During Windows build, I noticed that mingw32-make only used one core since my CPU was pegged at 33% the whole time. Is there a way to make it use the whole CPU so it won't take 4-5 hours to build?
Thanks in advance for any help/suggestions.
Try this to get the available drivers for you.
QSqlDatabase * db = new QSqlDatabase;
qDebug() << db->drivers();
This will give you the list of available drivers.
Check whether "QMYSQL" is there or not.
If it is not there, you'll have to install the driver.
Check this link for the installation.