Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: Database Drivers Related to Qt

  1. #1
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Smile Database Drivers Related to Qt

    Dear Forums,


    I want some information related to the database drivers that to be included for QT....As we know that Sqlite is inbuilt given in QT SDK but i want it to be done using Mysql,Psql etc i have google searched and came to know through that,that we can use other db's too.....So can anyone help me out in letting me know how to use drivers for those databases as of Sqlite and dump data from device to machine and vice versa.........Do let me know if so any reviews and answers..........Thanks in Advance.........



    Regards,

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Database Drivers Related to Qt

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Database Drivers Related to Qt

    Hi Wysota,

    Thanks for the review....I havent asked anything other than QT related issues i was asking can i use db which is not Sqlite as i have google searched and found that we can use Mysql,Psql i guess thats completely related to QT if im not wrong.......I just want to know how to add plugins,drivers related to Mysql,Psql in QT........that was my Question Wysota.......Thanks in Advance ....Any solution would be appreciable..........


    Regards,

  4. #4
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Database Drivers Related to Qt

    Yes you can use it, that what he was telling.

    These all are supported database list.

    Supported Databases

    The table below lists the drivers included with Qt. Due to license incompatibilities with the GPL, not all of the plugins are provided with Open Source Versions of Qt.

    Driver name

    QDB2 , QIBASE, QMYSQL, QOCI, QODBC, QPSQL, QSQLITE2, QSQLITE, QTDS
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  5. The following user says thank you to sonulohani for this useful post:

    StarRocks (5th October 2012)

  6. #5
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Smile Re: Database Drivers Related to Qt

    Hi sonulohani,

    Thanks for the solutions.........As you said bcoz of few licences issue we dont have other db's inbulit in the opensource.....i completely agree with it see for using Sqlite i have written this in the .pro file QT += sql \ in the same way my question is,is there any statements that i can use for Mysql and other db's so that db connection shouldnt be a problem like having those in the .pro files that was my query..........Hope you understood me..........Thanks in advance ........Any Solution would be appreciable.......



    Regards,

  7. #6
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Database Drivers Related to Qt

    In wysota's link is described how to build plugins (drivers) for another dbs. Just read this.

  8. #7
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Database Drivers Related to Qt

    Hi Leslok,

    Thanks for the Advice.........I came to know very before through that link only that we can access different databases using Qt.....but i just wanted to know how exactly can i create a pluginn for Mysql i have gone through the links and a bit confused with it.......Wanna know what line or statement can i add in the .pro file ........Thats whai i am looking for i found in the link that mysql is stored in /usr/local where in my system its stored in /usr/share so im a bit confused with it....Can anyone give me a better solution......Any Solution would be appreciable.....Thanks in advance......


    Regards,

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Database Drivers Related to Qt

    Quote Originally Posted by StarRocks View Post
    Thanks for the review....I havent asked anything other than QT related issues i was asking can i use db which is not Sqlite as i have google searched and found that we can use Mysql,Psql i guess thats completely related to QT if im not wrong.......I just want to know how to add plugins,drivers related to Mysql,Psql in QT........that was my Question Wysota.......Thanks in Advance ....Any solution would be appreciable..........
    I think you are referring to my signature.

    Quote Originally Posted by StarRocks View Post
    Thanks for the Advice.........I came to know very before through that link only that we can access different databases using Qt.....but i just wanted to know how exactly can i create a pluginn for Mysql i have gone through the links and a bit confused with it.......Wanna know what line or statement can i add in the .pro file ........Thats whai i am looking for i found in the link that mysql is stored in /usr/local where in my system its stored in /usr/share so im a bit confused with it....Can anyone give me a better solution......Any Solution would be appreciable.....Thanks in advance......
    You don't have to create any plugins. A plugin for MySQL is already available. As long as you have it installed, using it is just a matter of calling QSqlDatabase::addDatabase().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #9
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Database Drivers Related to Qt

    All the plugin are already available. For using it just write QT += sql in .pro file.

    See the ewxample:-
    Qt Code:
    1. #include <QtGui>
    2. #include <QtSql>
    3. int main(int argc,char* argv[])
    4. {
    5. QApplication app(argc,argv);
    6. QTableWidget* table = new QTableWidget();
    7. table->setWindowTitle("Connect to Mysql Database Example");
    8.  
    9. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    10. db.setHostName("192.168.11.3");
    11. db.setDatabaseName("menudb");
    12. db.setUserName("root");
    13. db.setPassword("test");
    14. if (!db.open())
    15. {
    16. QMessageBox::critical(0, QObject::tr("Database Error"),
    17. db.lastError().text());
    18. }
    19.  
    20. QSqlQuery query("SELECT * FROM test");
    21.  
    22. table->setColumnCount(query.record().count());
    23. table->setRowCount(query.size());
    24.  
    25. int index=0;
    26. while (query.next())
    27. {
    28. table->setItem(index,0,new QTableWidgetItem(query.value(0).toString()));
    29. table->setItem(index,1,new QTableWidgetItem(query.value(1).toString()));
    30. index++;
    31. }
    32.  
    33. table->show();
    34. return app.exec();
    35. }
    To copy to clipboard, switch view to plain text mode 

    This is how you connect the QT with MySql.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  11. #10
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Database Drivers Related to Qt

    Hi Sonulohani,

    Thanks for the reply............I have worked on the example that you send me and its working fine.....
    Regards,


    Added after 51 minutes:


    Dear Sonulohani,


    I have one more doubt can i connect to SqlServer and QPSQL from QT because when i try to connect to the given databases it not allowing me to retrieve data rather showing me an error that "Drivers not supported" .......So please let me know is it possible to connect if so how can i create pluginns for it..............Thanks in Advance...........Any solution would be appreciable......


    Regards,
    Last edited by StarRocks; 8th October 2012 at 11:27.

  12. #11
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Database Drivers Related to Qt

    Check the installed SQL Database drivers from this:-

    Qt Code:
    1. qDebug()<<db.drivers();
    To copy to clipboard, switch view to plain text mode 

    It will display a list of sql drivers installed in your system.

    If you don't have that driver then you have to build it.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  13. #12
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Database Drivers Related to Qt

    Dear sonulohani,


    Thanks for the reply..........I already know that i have only Mqsql and Sqlite in my System...I would like to know how to build a library file because that solves problems of most of the database connectivity if im not wrong......Thnaks in Advance....Any Solution would be appreciable..........


    Regards,

  14. #13
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Database Drivers Related to Qt

    Hey,hit on the thanks button.

    Here is the tutorial for how to build the QPSQL plugin:-

    http://www.qtcentre.org/wiki/index.p...ws_using_MinGW
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  15. The following user says thank you to sonulohani for this useful post:

    StarRocks (8th October 2012)

  16. #14
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Database Drivers Related to Qt

    Dear sonulohani,


    Thanks for the reply..........Im not using Windows im using Linux OS(Ubuntu).........So can you send me the steps related to building of drivers it would be good if you send me for those........Thanks in advance.........Any solution would be appreciable.........


    Regards,

  17. #15
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Database Drivers Related to Qt

    QPSQL for PostgreSQL (Version 7.3 and Above)

    General Information about the QPSQL driver

    The QPSQL driver supports version 7.3 and higher of the PostgreSQL server. We recommend that you use a client library from version 7.3.15, 7.4.13, 8.0.8, 8.1.4 or more recent as these versions contain security fixes, and as the QPSQL driver might not build with older versions of the client library depending on your platform.
    For more information about PostgreSQL visit http://www.postgresql.org.

    QPSQL Unicode Support
    The QPSQL driver automatically detects whether the PostgreSQL database you are connecting to supports Unicode or not. Unicode is automatically used if the server supports it. Note that the driver only supports the UTF-8 encoding. If your database uses any other encoding, the server must be compiled with Unicode conversion support.
    Unicode support was introduced in PostgreSQL version 7.1 and it will only work if both the server and the client library have been compiled with multibyte support. More information about how to set up a multibyte enabled PostgreSQL server can be found in the PostgreSQL Administrator Guide, Chapter 5.

    QPSQL BLOB Support
    Binary Large Objects are supported through the BYTEA field type in PostgreSQL server versions >= 7.1.
    How to Build the QPSQL Plugin on Unix and Mac OS X
    You need the PostgreSQL client library and headers installed.
    To make qmake find the PostgreSQL header files and shared libraries, run qmake the following way (assuming that the PostgreSQL client is installed in /usr):
    Qt Code:
    1. cd $QTDIR/src/plugins/sqldrivers/psql
    2. qmake "INCLUDEPATH+=/usr/include/pgsql" "LIBS+=-L/usr/lib -lpq" psql.pro
    3. make
    To copy to clipboard, switch view to plain text mode 

    After installing Qt, as described in the Installing Qt on X11 Platforms document, you also need to install the plugin in the standard location:
    Qt Code:
    1. cd $QTDIR/src/plugins/sqldrivers/psql
    2. make install
    To copy to clipboard, switch view to plain text mode 
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  18. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Database Drivers Related to Qt

    Quote Originally Posted by StarRocks View Post
    Thanks for the reply..........Im not using Windows im using Linux OS(Ubuntu).........So can you send me the steps related to building of drivers it would be good if you send me for those........Thanks in advance.........Any solution would be appreciable.........
    sudo apt-get install libqt4-sql-psql postgresql-client
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. #17
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Database Drivers Related to Qt

    Dear wysota,

    Thanks for the reply..........I have already installed Postgresql in my system i query is how would i use it in Ubuntu i am very confused when to add the lines that you were asking me to do...........Let me know the suitable and understandable steps to build a .so file for the related database Postgresql and Sql Server.Thanks in advance........Any solution would be appreciable.......


    Regards,

  20. #18
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Database Drivers Related to Qt

    sudo apt-get install libqt4-sql-psql postgresql-client
    This is the psql library for qt. There is no need to build the library. Just install it. It will automatically create the .so lib.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  21. #19
    Join Date
    Jul 2012
    Location
    Hyderabad
    Posts
    82
    Thanks
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Database Drivers Related to Qt

    Dear sonulohani,

    Thanks for your valuable favour..........But say me where can i find the above mentioned .so file ............Thanks in advance......Any solution would be appreciable is it the same for Sql Server..........

    Regards,


    Added after 4 minutes:


    Dear sonulohani,


    I have done with Postgresql and its working fine now i want to try with ODBC im very confused because ODBC means oracle related db but found in good search that it supports Sql server........So jus say me how to build a library for that..........Any solution would be appreciable.........Thanks n Advance................


    Regards,
    Last edited by StarRocks; 8th October 2012 at 13:40.

  22. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Database Drivers Related to Qt

    Quote Originally Posted by StarRocks View Post
    how would i use it in Ubuntu i am very confused when to add the lines that you were asking me to do
    http://www.lmgtfy.com?q=apt-get+ubuntu
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Database drivers missing
    By EvIL_GuY in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2012, 23:00
  2. Replies: 1
    Last Post: 9th January 2012, 00:23
  3. how to install DataBase Drivers
    By un9tsandeep in forum Qt Programming
    Replies: 2
    Last Post: 4th October 2011, 12:44
  4. LGPL and distributing QT database drivers
    By BitRogue in forum General Discussion
    Replies: 4
    Last Post: 7th July 2011, 09:32
  5. database drivers - installation
    By banita in forum Qt Programming
    Replies: 5
    Last Post: 29th April 2010, 19:26

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.