Results 1 to 2 of 2

Thread: Unable to connect to mariadb database server with qt 4.8.5 and Ubuntu 12.04

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2013
    Posts
    25
    Thanks
    7
    Qt products
    Qt5

    Default Unable to connect to mariadb database server with qt 4.8.5 and Ubuntu 12.04

    I use the following code to connect to a MySQL server database.

    Qt Code:
    1. QSqlDatabase db_Server = QSqlDatabase::database("Test");
    2.  
    3. //find mysql driver
    4. db_Server = QSqlDatabase::addDatabase("QMYSQL","Test");
    5. db_Server.setHostName("188.**.***.***");
    6. db_Server.setPort(3306);
    7. db_Server.setDatabaseName("Test");
    8. db_Server.setUserName("Test");
    9. db_Server.setPassword("*********");
    10.  
    11. bool ret = db_Server.open();
    12. if(ret) qDebug() << "Database open"
    13. else qDebug() << db_Server.lastError().text();
    To copy to clipboard, switch view to plain text mode 

    Lately they changed the server to mariadb and I assumed it was compatible with QMYSQL driver and used the above code to access the database, but I get the following error
    "Can't connect to MySQL server on '188.**.***.***' (101) QMYSQL: Unable to connect"

    Is there any additional thing that I need to do with mariadb to connect to the server? Any help is appreciated

    I had built the MySQL plugin the following way
    #sudo apt-get install libmysqlclient-dev
    #cd $QTDIR/src/plugins/sqdrivers/mysql
    #sudo qmake “INCLUDEPATH+=usr/include/mysql” “LIBS+=-L/usr/lib/i386-linux-gnu –lmysqlclient_r” mysql.pro
    #sudo make
    #sudo make install

    Should I do any changes for mariadb similarly?
    Last edited by gfernandes; 15th June 2015 at 15:26.

Similar Threads

  1. compatibility of qt4.8.2 with qt 5.1.1
    By ntl in forum Qt Programming
    Replies: 2
    Last Post: 28th January 2015, 20:48
  2. Qt and MariaDb driver
    By friendofgermany in forum Qt Programming
    Replies: 0
    Last Post: 26th May 2014, 09:34
  3. Replies: 4
    Last Post: 12th May 2011, 10:06
  4. 64 bit compatibility
    By johnmauer in forum Qt Programming
    Replies: 4
    Last Post: 25th December 2009, 13:28
  5. VTK and QT compatibility
    By nasty81 in forum Qt Programming
    Replies: 1
    Last Post: 11th April 2008, 12:32

Tags for this Thread

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.