Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problems with QSQLite



  • No, your real problem is that your code is just wrong.
    @
    // example taken from the QSqlDatabase documentation

    QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
    db.setHostName("acidalia");
    ...

    // your code

    QSqlDatabase db;
    db.addDatabase("QSQLITE");
    db.setDatabaseName("GestionVinoteca");
    ...
    @



  • Port 1521 is Oracle. PostgreSQL is usually 5432.



  • You can set credentials and port for sqllite database?



  • 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



  • The Qt oracle driver must be built manually. See the "Manual":/doc/qt-4.8/sql-driver.html for the instructions.



  • i followed the guide and finally, in the last step i get the error: nmake is not known as a command intern extern, program or file...

    so i tried to run mingw32-make and i get like tons of errors like it is not recognising any QT library



  • i just downloaded nmake pasted on the folder that i did the qmake...when i run the command nmake i get the same error as running it with mingw32-make....

    its my first time with Qt and im having a real headache



  • Just run nmake from the visual studio command prompt.



  • 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()!



  • Ps: thanks everyone!



  • Which toolchain are you using? Visual Studio or MinGW?



  • MinGW and i run the command mingw32-make and i get the errors of the image :/



  • I can't remember my pass on qtcenter. I guess you are using qmake from QT console. The error you get using the console is normal. Run nmake or WhatEverYouWantMake using full path. c:/folder/builder/someting.exe.



  • same output...same fu*** errors.. sorry i dont know whats happening



  • 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).



  • lol yes sorry. I have no problem with sqlite. Someone solved it by changing my code (ty someone) the problem now is how to install occi drivers cause i follow the documentation but nothing happens. I have an oracle database and i want to use it :/



  • 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 directory F:/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 directoryF:/QtSKD/QtSources/4.7.4/src/plugins/sqldriv
    ers/oci'
    mingw32-make: *** [debug-all] Error 2 @



  • problem solved FUCK YEAH





  • Man, I have asked for help about MYSQL driver about 1 month ago(I am using qt static and want to obtain a lib not a dll). I have compiled and recompiled that small sqldriver project about 100 times:) Finally I got it, and released just an .exe with all QT features :)) I am glad you have managed to build a sqldriver on you own and hope that in future you will share your adventures :P


Log in to reply