PDA

View Full Version : SQLite3 and Qt



k12yp70n
26th February 2009, 15:41
Hi there folks!

I've got a little big problem which is already giving me a huge headache...

I am trying to establish a connection to a file database created using sqlite3, but for some reason I can't!

I've first tried to use the following code:


QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setHostName("localhost");
db.setDatabaseName("medadmin");
db.setUserName("****");
db.setPassword("*****");

and it didn't work. After some research I found out that Sqlite3 doesn't use permissions on its databases and so I removed the last two lines of the above code (needless to say it didn't work).

What am I doing wrong??? should I set the host name to the full path of the file???

Thanks in advance,
:o

janus
26th February 2009, 16:36
Hi,

use the full path as the database name. You do not need to set the host as well.

lyuts
27th February 2009, 10:22
You don't have to specify the user and password either, since sqlite doesn't support authorization.

k12yp70n
18th March 2009, 15:18
Thank you very much!