[Qt-interest] Long-term SQL connections

Israel Brewster israel at frontierflying.com
Mon May 30 19:37:59 CEST 2011


I have an app that I have written which is intended to be kept running for long periods of time (several days or more, perhaps even weeks or months). This app uses a SQL backend (and, thus, obviously a connection to said backend) to store data, however it only needs to access said data occasionally and for short periods of time. As such, it seems to me that it doesn't make sense to keep the database connection open the entire time it is running. I had thought I could "solve" this by simply calling QSqlDatabase::close() after each data burst and QSqlDatabase::open() before, but this appears to mess up my in-memory models. At any rate, I start getting weird behavior like data no longer being recorded, even though I made sure to call open() before trying to modify the record.

Is there a better way of doing this? Or should I simply not worry about it?
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Era Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x7293
-----------------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110530/18f308f0/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 417 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110530/18f308f0/attachment.bin 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110530/18f308f0/attachment-0001.html 


More information about the Qt-interest-old mailing list