Problems with QSQLite
-
hi guys, im cracking my head against the wall...i ve read the documentation and everything but i cannot make this work. I must say i m new to QT but here is what i do:
@
qDebug() << QSqlDatabase::drivers();
qDebug () << QCoreApplication::libraryPaths ();
QSqlDatabase db;
db.addDatabase("QSQLITE");
db.setDatabaseName("GestionVinoteca");
db.setUserName("admin");
db.setPassword("fapfap");
db.setPort(1521);
bool ok = db.open ();
if (ok)
qDebug("OK.");
else
qDebug("%s", qPrintable(db.lastError().text()));
@------------and this is the result:
@
("QSQLITE") <-- drivers intalled
("F:/QtSKD/Desktop/Qt/4.7.4/mingw/plugins", "C:/Documents and Settings/home/Escritorio/Los taninos-killgabio/GestionVinoteca-build-desktop/release")
Driver not loaded Driver not loaded@in my .pro i have @QT += core gui sql@
i cannot get the solution after all reading. Another thing i couldnt do is run nmake after doing qmake even though i downloaded the latest version...the thing is that when i run it i get these kind of errors: QSmallInt is not recognized bla bla...
i really need a hand..thank u all
-
Just have another read on "QSqlDatabase":http://developer.qt.nokia.com/doc/qt-4.8/qsqldatabase.html#details, especially the example, and I do not wonder that the compiler complains about QSmallInt, because there is no such class QSmallInt.
-
i was wrong about QSmaillInt sorry about that (when i run mingw32-make says that QString is not a type)
what ever, my real problem is the driver not loaded, i tried placing qsqlite4.dll 's in my app folder but nothing i dont know what to do i been reading all day and i cant get and answer
i dont know why this happens cause i installed the Qt skd latest version this morning and its supposed to have qsqlite ready to be used...
Hope you can help.
-
No, your real problem is that your code is just wrong.
@
// example taken from the QSqlDatabase documentationQSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
db.setHostName("acidalia");
...// your code
QSqlDatabase db;
db.addDatabase("QSQLITE");
db.setDatabaseName("GestionVinoteca");
...
@ -
thank u all...the problem was the code :(
but then again i have another question..i have an oracle database so the drivers i should use are QOCCI, right? the problem is that when i paste them on my plugins path of the QtSKD say`s that the drivers are not installed...
what should i do? cause i read the documentation and i run the qmake it generates the files but when i run nmake the commandpromt tells that nmake is not a command...
then again thank u all
-
why should i have Visual Studio if im trying to install the OCI?? i think the problems are the dependencies with Qt cause the errors i get when trying to install them manually or building the .pro file with QtCreator are because it doesnt recognise QString and those libraries...
!http://www.qtcentre.org/attachment.php?attachmentid=7287&d=1326927709()!
-
Hey, temper temper. You might have something wrong with your env variables when you run from QtCreator. You said that you have copied qsqllite4.dll into the folder of your app, but this won't help. When deploying you must make a subdir called "sqldrivers" there you have to copy qsqllite4.dll if you run the release version or qsqllite4d.dll if you run the debug version. To be sure just copy both.
Another thing if you have those two dlls then you definetly have sqllite support. The SDK version has it. If nothing works try uninstalling all and reinstall it again. However when I have compiled Qt as static from the vanilla sources I didn't have any problem in using qsqllite(do not use: -no-sql-sqlite and or -system-sqlite). -
-
i managed to get to this, but i cant solve the problem i cant find any lQtsqld in my system:
@F:\QtSKD\QtSources\4.7.4\src\plugins\sqldrivers\oci>mingw32-make
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directoryF:/QtSKD/QtSources/4.7.4/src/plugins/sqldri vers/oci' g++ -mthreads -shared -Wl,--out-implib,f:\QtSKD\QtSources\4.7.4\plugins\sqldrive rs\libqsqlocid4.a -o ..\..\..\..\plugins\sqldrivers\qsqlocid4.dll tmp/obj/debug_ shared/main.o tmp/obj/debug_shared/qsql_oci.o tmp/obj/debug_shared/moc_qsql_oci. o tmp/obj/debug_shared/moc_qsqldriverplugin.o -L"f:\QtSKD\QtSources\4.7.4\lib" -L"%LIB%" -L"f:\oraclexe\app\oracle\product\11.2.0\server\oci\lib\msvc" -L"f:\Qt SKD\QtSources\4.7.4\lib" tmp\obj\debug_shared\qsqlocid_resource_res.o -loci -lQt Sqld -lQtCored f:/qtskd/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cann ot find -lQtSqld collect2: ld returned 1 exit status mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlocid4.dll] Error 1 mingw32-make[1]: Leaving directory
F:/QtSKD/QtSources/4.7.4/src/plugins/sqldriv
ers/oci'
mingw32-make: *** [debug-all] Error 2 @