开发者

Should I Use Single Connection or Multiple Connections with QSqlDatabase

开发者 https://www.devze.com 2023-01-16 01:10 出处:网络
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 th

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号