qtjambi
Qt Jambi and not MySQL
Yes, the title is correct. I just tried to connect to a MySQL database from a Qt Jambi application, using the following code:
QSqlDatabase db = QSqlDatabase.addDatabase("QMYSQL"); db.setHostName("localhost"); db.setDatabaseName("qttest"); db.setUserName("qt"); db.setPassword("jambi"); boolean ok = db.open();
Which provokes:
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE
Nice. Googled that, result: I would need to compile the Qt MySQL plugin from source. No precompiled DLL is available for download.
I suppose I’ll switch over to JDBC/Hibernate :-)
By the way, the current Qt Jambi documentation doesn’t mention database connections at all. The code snippet I posted was taken directly from the API documentation (javadoc).
Qt Jambi + Eclipse
Several years ago, I wrote a couple of articles about GUI development with C++ using Trolltech Qt as the GUI framework. Some months ago, Trolltech released Qt Jambi, the Java version of Qt. Today, I decided to give it a try using Eclipse and Qt Jambi as my tools.
Some notes on the installation process:
- If you don’t already have one, get a current JDK, at least version 1.5
- Get a current Eclipse, Ganymede for example, pick a Java-optimized bundle
- Get Qt Jambi here
- Get the Qt Jambi Eclipse plugin for Java – note: scroll down to the bottom of the page, or you will end up like me downloading the C/C++ Eclipse plugin which will not be of much use :-)
- Unzip all packages
- Put the jar files from the Qt Jambi Eclipse integration package into eclipse/plugins
- Start Eclipse, go to Window -> Preferences -> QtJambi preferences and define the location where you put Qt Jambi
- Go downtown for brunch and continue the article later
To be continued!