[Qt-jambi-interest] Qt-Jambi and MySQL access

Petric Frank pfrank at gmx.de
Tue Aug 11 06:00:22 CEST 2009


Hello,

i am new to Qt-Jambi, but i've used Qt/C++ for some of my applications.

Using Qt-Jambi-4.5.2 precompiled (+ Eclipse plugin) i tried to do some queries 
using a MySQL database. Alike coding in C++ i tried this code snippet:

  QSqlDatabase db = QSqlDatabase.addDatabase ("QMYSQL");
  db.setDatabaseName ("db");
  db.setUserName ("user");
  db.setPassword ("pass");
  if (!db.open ()) {
    QMessageBox.critical(null, QApplication.instance().tr ("can't open db"),
        			                   db.lastError ().text ());
    return;
  }
  QSqlQueryModel tabledata = new QSqlQueryModel ();
  tabledata.setQuery ("select * from table");

but i got the info that currently QSQLITE is the only driver available. For me 
this is similar to Qt/C++. There i had to compile the MySQL module manually.

So i tried to do this here also. But after hours digging around i haven't 
found a guide how to do that.

Could someone point me to some guide or hints to accomplish this ?

As far as i know (i'm more a beginner in Java programming) jdbc may also be 
used to access MySQL. How the code above have to be rewritten.
Probably someone have already written a jdbc(-mysql) driver for Qt-Jambi ...

The development platform is Linux.

thanks.

regards
  Petric



More information about the Qt-jambi-interest mailing list