Results 1 to 4 of 4

Thread: [QT4.1] QSqlDatabase duplicate connection error.

  1. #1
    Join Date
    Feb 2006
    Posts
    25
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [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.

    Qt Code:
    1. QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.
    To copy to clipboard, switch view to plain text mode 

    What is the best way of fixing this problem?

    Thanks in advanced.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QT4.1] QSqlDatabase duplicate connection error.

    You can only have one default connection opened --- either reuse it or create connections with different names.

  3. #3
    Join Date
    Jan 2006
    Posts
    75
    Thanks
    3
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default 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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QT4.1] QSqlDatabase duplicate connection error.

    Quote Originally Posted by ball
    never use like this:
    QSqlDatabase::addDatabase();
    Not never --- just at most once.

Similar Threads

  1. Problems
    By euthymos in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2006, 20:11
  2. Fed up with M$ Window$ !!! Why is Tux leaving me alone???
    By fullmetalcoder in forum General Discussion
    Replies: 35
    Last Post: 18th March 2006, 13:57
  3. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 13:54
  4. lQtGuid4 error - Compiler setting problem
    By Kapil in forum Installation and Deployment
    Replies: 7
    Last Post: 10th February 2006, 10:30
  5. qmake_image_collection.cpp gives me a compiling error
    By vfernandez in forum Qt Programming
    Replies: 2
    Last Post: 31st January 2006, 02:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.