Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
I am trying to combine the non-commercial Windows edition of Qt Designer 3.2, which uses Qt 3.2.1, with SQLite Browser version 1.2.1. I created a SQLite database data/sqlitetest.db in a subdirectory of the Qt Designer project. The database contains one table 'test' with a few fields and a few records.
The SQLite browser sees and handles the database fine. Congratulations ! However, when I try to define a database connection for a small test project in the Qt Designer it fails to connect to the SQLite database. I use the following parameters for the connection :
name = (default)
driver = QSQLITEX
db name = data/sqlitetest.db
username = NULL (ie. I leave it empty)
password = NULL (ie. I leave it empty)
hostname = localhost
port = Default
When I create a DataTable object on the projects form the connection wizard comes up and shows the (default) connection, but no available tables.
What am I missing here ?
SQLite Database Browser does not use the Qt SQL classes, all database activity is handled by the internal implementation (most of it is in file sqlitedb.cpp). At the time it was developed the Qt-SQL-SQLite classes were in beta and not very reliable. Even today I believe that having specific classes is better for the purposes of our application.
Qt 4 is about to be released, and it includes a much improved and changed SQL model. Making a simple browser for an SQLite 3 datasource is very easy with Qt4, and in fact will ship with a simple one in the sample code.
[quote]SQLite Database Browser does not use the Qt SQL classes[/quote]
At the time of development not using the Qt SQL classes was probably a good management decision.]
[quote]Qt 4 ... includes a much improved and changed SQL model.[/quote]
Right. But then again the Qt 4 Designer will no longer contain a code editor. Meaning that one has to revert to a much more complex IDE like KDevelop with a very steep learning curve.
Meanwhile I discovered at http://www.codeskipper.com/article/23/#id41_href that I should fill in the complete path to the database file like :
and that I should leave all other connection parameters empty. However, doing so in the Designer yields an error that goes something like : "file image damaged."
Therefore I believe that the QSQLITEX driver that came with my copy of the non-commercial Qt Edition can't cope with SQLite 3 databases created with SQLite Browser version 1.2.1. Right ?
If so, which version of SQLite Browser creates SQLite 2 databases ?
[quote]which version of SQLite Browser creates SQLite 2 databases ?[/quote]
Found the answer to that one myself by looking at the changelog at
It says : "Users that need to work with SQLite 2.x database files should continue to use version 1.1 of SQLite Database Browser."
I'll give it a try and post my findings here.
Whatever I try, the above mentioned Windows versions of these packages don't want to cooperate. I'll revert to my faithfull Gentoo Linux.
On my Gentoo Linux I use :
* SQLite 2.8.15
* Qt Designer 3.3.4
A test application with two QDataTables shows the records of both tables when previewing the form in the designer. However, when running the compiled application the records no longer show.
My main.cpp contains
travelmate = QSqlDatabase::addDatabase("QSQLITE");
Apparently the preview mode is intelligent enough to add the columns for the record fields. However, for the records to show in the compiled version, one has to manually add the columns for the record fields to the QDataTables in the Designer.
Which is still weird, but the problem is solved !