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. Set connection name for QSqlDatabase. How?
Forum Updated to NodeBB v4.3 + New Features

Set connection name for QSqlDatabase. How?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 644 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.
  • B Offline
    B Offline
    bogong
    wrote on 4 Nov 2019, 17:39 last edited by
    #1

    Hello all!
    I've got this error:

    QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
    QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
    

    Briefly - I am using for user data and for storing logs QSqlDatabase, and there are two separated DB one for user one for logbook. Is there any way to define connection name and use it in parallel without affecting each other ?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bogong
      wrote on 4 Nov 2019, 17:42 last edited by
      #2

      Solution found https://doc.qt.io/qt-5/qsqldatabase.html#addDatabase
      Issue closed.

      M 1 Reply Last reply 4 Nov 2019, 17:42
      1
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 4 Nov 2019, 17:42 last edited by
        #3

        Hi
        Yes there is
        https://forum.qt.io/topic/76810/use-two-or-more-sqlite-database-at-the-same-time/2

        see jsulm answer

        https://doc.qt.io/qt-5/qsqldatabase.html#addDatabase

        1 Reply Last reply
        1
        • B bogong
          4 Nov 2019, 17:42

          Solution found https://doc.qt.io/qt-5/qsqldatabase.html#addDatabase
          Issue closed.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 4 Nov 2019, 17:42 last edited by
          #4

          @bogong
          haha. same time :)

          1 Reply Last reply
          0
          • C Online
            C Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 4 Nov 2019, 17:43 last edited by
            #5

            See QSqlDatabase::addDatabase() and QSqlDatabase::database()

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            2

            1/5

            4 Nov 2019, 17:39

            • Login

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