Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Build SQLite with Qt5
QtWS25 Last Chance

[SOLVED] Build SQLite with Qt5

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 6.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ravenblack
    wrote on last edited by
    #1

    I have been stuggling for about 4 days to firgure out why my SQL queries does not work. I found out that my drivers are not "loaded" (according to the lastError().text() ). I cant figure out how to make this QSQLite work. I installed Qt5.0.2 and it does not work. Do I need to download the plugin or what? Please help me I am extremely frustrated. I think I need to build the SQlite plugin, but I have no idea how.
    Thanks in advance.

    1 Reply Last reply
    0
    • mrdebugM Offline
      mrdebugM Offline
      mrdebug
      wrote on last edited by
      #2

      Hi. Qt wants the plugin for manage sqlite archives. The plugins are located in /usr/local/Qt-5.0.2/plugins in my machine for example.
      If you want to install your application in a machine without Qt installed you have to copy the right plugin directory, and place it where the application can find it.
      You can use qt.conf file to specify the path.
      Is not difficoult but if this is your first time with Qt plugins you have to spend some time to learn how those works.

      Need programmers to hire?
      www.labcsp.com
      www.denisgottardello.it
      GMT+1
      Skype: mrdebug

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SergioDanielG
        wrote on last edited by
        #3

        Maybe this is not util, but yesterday I'd installed Qt 5.0.2 to continued with a project where I use sqlite and is working without problems.
        Regards.

        www.ftatv.com.ar El foro argentino de la TV libre

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Ravenblack
          wrote on last edited by
          #4

          Okay, I found the solution.

          1. I uninstalled Qt
          2. Downloaded the tarball (.tar.gz file containing the source code for Qt (Windows users use the .zip file)).
          3. Configure with this command:
            @
            ./configure -plugin-sql-sqlite
            @

          or
          @
          ./configure -qt-sql-sqlite
          @

          If it gives you some shit about qtwebkits use just add the following to the configure command:
          @
          -skip qtwebkit
          @

          1. make and install with this commands:
            @
            make
            @

          after a few frieking hours, then
          @
          sudo make install
          @

          1. Now this is very important:
            when you declare QSqlQuery, declare it after you added the driver, i.e.:
            @
            QSqlDatabase db;
            db = QSqlDatabase::addDatabase( "QSQLITE" );
            if( db.open() )
            {
            QSqlQuery query; //NOTE THIS IS AFTER THE addDatabase("QSQLITE") FUNCTION!
            }
            @

          If for some reason you need the query to be declared earlier (like in a class) do this:
          @
          QSqlDatabase db;
          QSqlQuery query;

          //This is in another part of the code
          db = QSqlDatabase::addDatabase( "QSQLITE" );
          if( db.open() )
          {
          QSqlQuery tmp;
          query = tmp;
          }
          @

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved