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).

Tags: ,

Wednesday, October 22nd, 2008 Development No Comments

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:

  1. If you don’t already have one, get a current JDK, at least version 1.5
  2. Get a current Eclipse, Ganymede for example, pick a Java-optimized bundle
  3. Get Qt Jambi here
  4. 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 :-)
  5. Unzip all packages
  6. Put the jar files from the Qt Jambi Eclipse integration package into eclipse/plugins
  7. Start Eclipse, go to Window -> Preferences -> QtJambi preferences and define the location where you put Qt Jambi
  8. Go downtown for brunch and continue the article later

To be continued!

Tags: ,

Saturday, October 18th, 2008 Development, Java No Comments

Welcome!

Have fun reading this blog. You will find some "about" data if you follow the link in the header.

Archives