Should I Use Single Connection or Multiple Connections with QSqlDatabase
I have dependent and independent classes, I need to create database connections in these classes. As I understand from Qt documentation, if I create conn开发者_如何学Cections in default way, all of them use same connection.
Should I create different database connections for different classes, or should I use same database connection. What are pros and cons? Thanks.
I'm not sure why @Dummy00001 logged his response as a comment rather than an answer, but I concur with him. If you aren't going to be working with the database in a parallel fashion, you don't need multiple connections, and they will, in fact, be wasteful of resources both in your client library and on the server.
精彩评论