DB lost connection after 5 minutes aprox.
-
Hi!..
I'm using ODCB for MySQL, and developing a word processor that once user is finished writing it, he saves its contents as .html (QTexEdit to plainHTML) and send to ftp server, that is not a problem at all... but i need to write to my db an ID and a varchar string that handles the url for the document. The problem is that user could take a long time writing the document, lets say 20 minutes more less, in such time the db connection is lost, so when he clicks save, the content will send to ftp but will not be writen the db registry.
what is the best way to handle this?, how can i set limitess connection time?
what i tried is to check if connection is alive and is valid everytime i send a query, but those two bools are true even if the connection was gone...
thanks in advance.
-
Hi,
If there's no activity at all with the database during all that time then it would make more sense to open the database connection only when you actually need it.
-
Hi
I think its the interactive_timeout setting.but as @SGaist says, if you can wait to open until you need it, its more clean.
-
thanks for answering... So it is not a problem that i switch between opening and closing db for every query i do?
-
No it's not especially if you are doing them infrequently.
Beware if you are using a QSqlQueryModel or one of its subclasses, you can't do that.