Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Sample Sqlite Database Application
Forum Updated to NodeBB v4.3 + New Features

Sample Sqlite Database Application

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
17 Posts 4 Posters 6.1k Views 1 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    Then you should tell what version of Qt you are using, as well as developing platform, Android version etc.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Avtansh Sharma
      wrote on last edited by Avtansh Sharma
      #7

      Android OS version is 7.0 Nougat Cyanogen Mod
      Android Architecture is arm
      Host Machine OS -Ubuntu 16.04 lts
      QT creator version 4.3.1
      QT version Based on Qt 5.9.0 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
      I have not built this from source code. I ran offline installer

      jsulmJ 1 Reply Last reply
      0
      • A Avtansh Sharma

        Android OS version is 7.0 Nougat Cyanogen Mod
        Android Architecture is arm
        Host Machine OS -Ubuntu 16.04 lts
        QT creator version 4.3.1
        QT version Based on Qt 5.9.0 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
        I have not built this from source code. I ran offline installer

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @Avtansh-Sharma said in Sample Sqlite Database Application:

        QT version Based on Qt 5.9.0 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)

        This is from QtCreator "Help/About Qt Creator", right? This only says which Qt version was used to build QtCreator, it is not necessarily the Qt version you're using to build your app.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Avtansh Sharma
          wrote on last edited by
          #9

          Now this is confusing if it does not show version. Then what i need to get version

          jsulmJ 1 Reply Last reply
          0
          • A Offline
            A Offline
            Avtansh Sharma
            wrote on last edited by Avtansh Sharma
            #10

            Anyway is my orignal query a bug.?
            I don't understand why sqlite driver is missing on Android it should be package with apk file automatically.
            If there are any other steps please inform me

            1 Reply Last reply
            0
            • A Avtansh Sharma

              Now this is confusing if it does not show version. Then what i need to get version

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by jsulm
              #11

              @Avtansh-Sharma It is not confusing: "About SOMETHING" is always providing information about SOMETHING.
              So, in case of QtCreator it tells you what QtCreator version it is and what Qt version was used to build it.
              QtCreator can handle many different Qt versions at the same time.
              You should know what you installed. If not go to "Tools/Options/Build & Run/Qt Versions" and see there.

              Regarding your issue: you could manually check what is inside the APK. And you can try to set QT_DEBUG_PLUGINS, see http://doc.qt.io/qt-5/debug.html

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Avtansh-Sharma It is not confusing: "About SOMETHING" is always providing information about SOMETHING.
                So, in case of QtCreator it tells you what QtCreator version it is and what Qt version was used to build it.
                QtCreator can handle many different Qt versions at the same time.
                You should know what you installed. If not go to "Tools/Options/Build & Run/Qt Versions" and see there.

                Regarding your issue: you could manually check what is inside the APK. And you can try to set QT_DEBUG_PLUGINS, see http://doc.qt.io/qt-5/debug.html

                A Offline
                A Offline
                Avtansh Sharma
                wrote on last edited by
                #12

                @jsulm I have installed only qt 5.9.0

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Avtansh Sharma
                  wrote on last edited by
                  #13

                  I already set it to 1

                  Below is the output

                  W libsplinechart.so: (null):0 ((null)): QSqlDatabase: QSQLITE driver not loaded
                  W libsplinechart.so: (null):0 ((null)): QSqlDatabase: available drivers:

                  jsulmJ 1 Reply Last reply
                  0
                  • A Avtansh Sharma

                    I already set it to 1

                    Below is the output

                    W libsplinechart.so: (null):0 ((null)): QSqlDatabase: QSQLITE driver not loaded
                    W libsplinechart.so: (null):0 ((null)): QSqlDatabase: available drivers:

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #14

                    @Avtansh-Sharma There should be something above these two lines saying more about actual issue

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    A 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @Avtansh-Sharma There should be something above these two lines saying more about actual issue

                      A Offline
                      A Offline
                      Avtansh Sharma
                      wrote on last edited by
                      #15

                      @jsulm above these lines are only linking and compilation. If you want i can post it but I don't think it would be of use.
                      Anyway fyi
                      Starting remote process.I art : Late-enabling -Xcheck:jni
                      W System : ClassLoader referenced unknown path:
                      I QtCore : Start
                      W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Gui.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Widgets.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Charts.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5AndroidExtras.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Bluetooth.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Sql.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: unsupported flags DT_FLAGS_1=0x81
                      I Qt : qt start
                      I art : Do partial code cache collection, code=10KB, data=27KB
                      I art : After code cache collection, code=10KB, data=27KB
                      I art : Increasing code cache capacity to 128KB
                      W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libsplinechart.so: unused DT entry: type 0xf arg 0x73b4
                      W : (null):0 ((null)): QSqlDatabase: QSQLITE driver not loaded
                      W : (null):0 ((null)): QSqlDatabase: available drivers:
                      W : (null):0 ((null)): QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
                      D : ../splinechart/devicedata.cpp:55 (DeviceData::DeviceData(QObject*)): Error: connection with database fail
                      I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3_RB1__release_AU (I741a3d36ca)
                      I Adreno-EGL: OpenGL ES Shader Compiler Version: E031.29.00.00
                      I Adreno-EGL: Build Date: 04/04/16 Mon
                      I Adreno-EGL: Local Branch: mybranch19053788
                      I Adreno-EGL: Remote Branch: quic/LA.BF.1.1.3_rb1.12
                      I Adreno-EGL: Local Patches: NONE
                      I Adreno-EGL: Reconstruct Branch: NOTHING
                      I OpenGLRenderer: Initialized EGL, version 1.4
                      D OpenGLRenderer: Swap behavior 1
                      W Adreno-ES20: <get_gpu_clk:229>: open failed: errno 13
                      W : (null):0 ((null)): WARNING: QApplication was not created in the main() thread.
                      W libsplinechart.so: (null):0 ((null)): QSqlQuery::exec: database not open
                      W libsplinechart.so: (null):0 ((null)): QSqlQuery::exec: database not open
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqgif.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqicns.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqico.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqjpeg.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqtga.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqtiff.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqwbmp.so: unsupported flags DT_FLAGS_1=0x81
                      W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqwebp.so: unsupported flags DT_FLAGS_1=0x81
                      W libsplinechart.so: (null):0 ((null)): QSqlDatabase: QSQLITE driver not loaded
                      W libsplinechart.so: (null):0 ((null)): QSqlDatabase: available drivers:
                      W libsplinechart.so: (null):0 ((null)): QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
                      W libsplinechart.so: (null):0 ((null)): QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
                      D libsplinechart.so: ../splinechart/devicedata.cpp:55 (DeviceData::DeviceData(QObject*)): Error: connection with database fail
                      W libsplinechart.so: (null):0 ((null)): qt.bluetooth: Connecting to port is not supported
                      I libsplinechart.so: ../splinechart/devicedata.cpp:190 (int DeviceData::syncDeviceData(bool)): State 3
                      W libsplinechart.so: (null):0 ((null)): QSqlQuery::exec: database not open

                      jsulmJ 1 Reply Last reply
                      0
                      • A Avtansh Sharma

                        @jsulm above these lines are only linking and compilation. If you want i can post it but I don't think it would be of use.
                        Anyway fyi
                        Starting remote process.I art : Late-enabling -Xcheck:jni
                        W System : ClassLoader referenced unknown path:
                        I QtCore : Start
                        W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Gui.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Widgets.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Charts.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5AndroidExtras.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Bluetooth.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libQt5Sql.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/platforms/android/libqtforandroid.so: unsupported flags DT_FLAGS_1=0x81
                        I Qt : qt start
                        I art : Do partial code cache collection, code=10KB, data=27KB
                        I art : After code cache collection, code=10KB, data=27KB
                        I art : Increasing code cache capacity to 128KB
                        W linker : /data/app/org.qtproject.example.splinechart-1/lib/arm/libsplinechart.so: unused DT entry: type 0xf arg 0x73b4
                        W : (null):0 ((null)): QSqlDatabase: QSQLITE driver not loaded
                        W : (null):0 ((null)): QSqlDatabase: available drivers:
                        W : (null):0 ((null)): QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
                        D : ../splinechart/devicedata.cpp:55 (DeviceData::DeviceData(QObject*)): Error: connection with database fail
                        I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3_RB1__release_AU (I741a3d36ca)
                        I Adreno-EGL: OpenGL ES Shader Compiler Version: E031.29.00.00
                        I Adreno-EGL: Build Date: 04/04/16 Mon
                        I Adreno-EGL: Local Branch: mybranch19053788
                        I Adreno-EGL: Remote Branch: quic/LA.BF.1.1.3_rb1.12
                        I Adreno-EGL: Local Patches: NONE
                        I Adreno-EGL: Reconstruct Branch: NOTHING
                        I OpenGLRenderer: Initialized EGL, version 1.4
                        D OpenGLRenderer: Swap behavior 1
                        W Adreno-ES20: <get_gpu_clk:229>: open failed: errno 13
                        W : (null):0 ((null)): WARNING: QApplication was not created in the main() thread.
                        W libsplinechart.so: (null):0 ((null)): QSqlQuery::exec: database not open
                        W libsplinechart.so: (null):0 ((null)): QSqlQuery::exec: database not open
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqgif.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqicns.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqico.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqjpeg.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqtga.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqtiff.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqwbmp.so: unsupported flags DT_FLAGS_1=0x81
                        W linker : /data/data/org.qtproject.example.splinechart/qt-reserved-files/plugins/imageformats/libqwebp.so: unsupported flags DT_FLAGS_1=0x81
                        W libsplinechart.so: (null):0 ((null)): QSqlDatabase: QSQLITE driver not loaded
                        W libsplinechart.so: (null):0 ((null)): QSqlDatabase: available drivers:
                        W libsplinechart.so: (null):0 ((null)): QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
                        W libsplinechart.so: (null):0 ((null)): QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
                        D libsplinechart.so: ../splinechart/devicedata.cpp:55 (DeviceData::DeviceData(QObject*)): Error: connection with database fail
                        W libsplinechart.so: (null):0 ((null)): qt.bluetooth: Connecting to port is not supported
                        I libsplinechart.so: ../splinechart/devicedata.cpp:190 (int DeviceData::syncDeviceData(bool)): State 3
                        W libsplinechart.so: (null):0 ((null)): QSqlQuery::exec: database not open

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #16

                        @Avtansh-Sharma said in Sample Sqlite Database Application:

                        W : (null):0 ((null)): WARNING: QApplication was not created in the main() thread.

                        What is this? Do you create QApplication instance in another thread?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1
                        • A Offline
                          A Offline
                          Avtansh Sharma
                          wrote on last edited by
                          #17

                          I created QApplication and DeviceData(Sql commands) class in same thread.

                          #include <QtWidgets/QApplication>
                          #include <QtWidgets/QMainWindow>
                          #include <QtCharts/QChartView>
                          #include <QtCharts/QSplineSeries>
                          #include <devicedata.h>
                          #include <QThread>
                          #include <devicethread.h>
                          #include <themewidget.h>
                          #include <QtCore/QtPlugin>
                          //DeviceData obj_DeviceData;
                          QT_CHARTS_USE_NAMESPACE
                          //Q_IMPORT_PLUGIN(qsqlite)

                          int main(int argc, char *argv[])
                          {
                          QApplication a(argc, argv);

                          QMainWindow window;
                          ThemeWidget *widget = new ThemeWidget();
                          window.setCentralWidget(widget);
                          
                          window.resize(900, 600);
                          window.show();
                          DeviceData obj_DeviceData;
                          obj_DeviceData.syncDevice(true);
                          
                          return a.exec();
                          

                          }

                          Constructor of DeviceData

                          DeviceData::DeviceData(QObject *parent)
                          : QObject(parent), m_bluetoothSocket(0)
                          {

                          if (QSqlDatabase::drivers().isEmpty())
                                 qInfo()<<("This demo requires at least one Qt database driver. "
                                                             "Please check the documentation how to build the "
                                                             "Qt SQL plugins.");
                          try
                          {
                          m_bterminate=false;
                          qDebug() << QSqlDatabase::drivers();
                          m_db = QSqlDatabase::addDatabase("QSQLITE","SQLITE");
                          
                          //m_db.setDatabaseName("/home/user/db_Health.db");
                          
                          QString basePath = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)[1];
                          m_db.setDatabaseName(basePath+"/db_Health.db");
                          if (!m_db.open())
                          {
                              qDebug() << "Error: connection with database fail";
                              QSqlError error= m_db.lastError() ;
                              qInfo()<<error;
                          
                          }
                          
                          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