[QT4.1] QSqlDatabase duplicate connection error.
I have different areas on my sources where I declare a database object with addDatabase. When I run my code I get the following error.
Code:
QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
What is the best way of fixing this problem?
Thanks in advanced.
Re: [QT4.1] QSqlDatabase duplicate connection error.
You can only have one default connection opened --- either reuse it or create connections with different names.
Re: [QT4.1] QSqlDatabase duplicate connection error.
QSqlDatabase::addDatabase("QOCI","db1");
QSqlDatabase::addDatabase("QMYSQL","db2");
never use like this:
QSqlDatabase::addDatabase();
becoz that will use the default connection which can only be used once
Re: [QT4.1] QSqlDatabase duplicate connection error.
Quote:
Originally Posted by ball
never use like this:
QSqlDatabase::addDatabase();
Not never --- just at most once. ;)