-
http://www.qtcentre.org/threads/32585-QT-amp-SQLite-driver-not-loaded
QT & SQLite - driver not loaded
Hello!
I'm trying to read from SQLite database. I've wrote simple function:
Qt Code:-
void MainWindow :: odczytajBazeSQL ( )
-
{
-
-
QSqlDatabase bdb;
-
bdb. setDatabaseName ( "/test.db" );
-
bdb. open ( );
-
-
queryModel ->setQuery ( "SELECT * FROM t1", bdb );
-
-
ui ->tableView ->setModel (queryModel );
-
}
To copy to clipboard, switch view to plain text mode
test.db is a simple database with one table t1. When I'm trying to read with code above I get error:
Qt Code:-
QSqlDatabase : QSQLITE driver not loaded
To copy to clipboard, switch view to plain text mode
Normally I'm using sqlite3 to create and use databases. What should I do to make it work?
thanks in advance
best regards
Tomasz -
-
21st July 2010, 01:15 #2
Re: QT & SQLite - driver not loaded
-
The following user says thank you to wysota for this useful post:
Tomasz (21st July 2010)
-
21st July 2010, 10:22 #3
Intermediate user
-
Join Date
- Jul 2010 Location
- Poland Posts
- 184 Thanks
- 70
- Thanked 4 Times in 4 Posts Qt products
-
-
Re: QT & SQLite - driver not loaded
I've copied compilled driver (it wasn't there), I've change my code to:
Qt Code:-
-
bdb. setDatabaseName ( "./test.db" );
-
ok = bdb. open ( );
To copy to clipboard, switch view to plain text mode
and now It works fine,
best regards
TomaszLast edited by Tomasz; 21st July 2010 at 10:30.
-
21st July 2010, 10:28 #4
Re: QT & SQLite - driver not loaded
Change your code to:
Qt Code:-
bdb. setDatabaseName ( "/test.db" );
-
bdb. open ( );
To copy to clipboard, switch view to plain text mode -
The following user says thank you to wysota for this useful post:
Tomasz (21st July 2010)
-
22nd July 2010, 18:13 #5
Novice
-
Join Date
- Feb 2008 Posts
- 50 Thanks
- 1
- Thanked 2 Times in 2 Posts Qt products
-
-
Re: QT & SQLite - driver not loaded
Hello all. As we are speaking about SQLITE driver i had a very stressful experience with that driver (4.6.2/4.6.3). I deployed over 100 copies of one program using latest sqlite driver. There was no problem anywhere... i put the dll file under the executable file in directory "sqldrivers".
Only in some particular systems this new driver wasn`t loading... i was like O_o. I`m talking about 2% of all the systems.
I`ve spent a lot of hours debugging remotely the machines and didn`t find a way to make it work. But i knew my old software worked on those machines before... then i switched to a sqlite dll from 4.4.0 and .. magically the driver was loaded!
Apparently something in the driver changed but i couldn`t find time to investigate further.
Edit: the machines were WinXP Pro SP3.Last edited by sadjoker; 22nd July 2010 at 18:23.
QT & SQLite - driver not loaded[Win7 XP mode failed too]
最新推荐文章于 2025-06-19 22:54:31 发布