[PyQt] How to close QSqlDatabase connection?

Sibylle Koczian Sibylle.Koczian at t-online.de
Sun Nov 18 18:46:53 GMT 2007


Am Mittwoch, 14. November 2007 16:13:43 schrieb Sibylle Koczian:
>
> I will try to find out more: can I put part of the code into main(), but
> not all of it? Can I use such a function, if I don't call it "main()"? And
> I will certainly use another database backend (firebird), but at the moment
> I doubt very much if that will make any difference. It's more interesting
> to try PyQt applications not using a database with and without a separate
> "main()".
>

After much trial and still more error: 

- another database backend, firebird in my case, doesn't change anything.
- renaming the "main()" function doesn't change anything.
- PyQt applications without database connections: putting the "main code" 
(creating the QApplication instance, creating and showing the main window, 
calling sys.exit(app.exec_())) into a function called "main()" works without 
problems.
- PyQt applications with database connection: if and only if the QApplication 
instance is created in the main() function then I get this error message when 
I close the application: 
"QSqlDatabasePrivate::removeDatabase: 
connection 'qt_sql_default_connection' is still in use, all queries will 
cease to work."

Why?

Sibylle

-- 
Dr. Sibylle Koczian


More information about the PyQt mailing list