Important: Please read the Qt Code of Conduct -

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

  • 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.


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

  • 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.

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

    Thanks again...

Log in to reply