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. Could it be possible to have two different connections to handle two different databases?
QtWS25 Last Chance

Could it be possible to have two different connections to handle two different databases?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.8k 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.
  • P Offline
    P Offline
    pico
    wrote on last edited by
    #1

    Hi, Sir:
    I use QSqliteDatabase to addDatabse for two different files, however, it always show me "driver not loaded".
    Could anyone teach me how to have two databases simultaneously?

    PS: I don't use "attach" way because I need to handle them as two different connections.

    Thanks a lot.

    BR,
    Pico

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Let me get this straight: you have no problems using a single SQLite database connection, but you can not make a second one work?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        You can call addDatabase() twice; just be sure to give different connection names in the two calls. In subsequent calls to QSqlDatabase::database() put the name of the desired connection to the argument list.

        For your errors: Show us some code please, we cannot guess what you are doing.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pico
          wrote on last edited by
          #4

          Hi, All:
          Thanks a lot. I just follow your recommendation, and it works now.

          Thanks again...

          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