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?

Set connection name for QSqlDatabase. How?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 629 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.
  • B Offline
    B Offline
    bogong
    wrote on 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 last edited by
      #2

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

      mrjjM 1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on 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

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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @bogong
          haha. same time :)

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 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

            • Login

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