Results 1 to 6 of 6

Thread: H2 database and Qt Database support

  1. #1
    Join Date
    Aug 2007
    Posts
    266
    Thanks
    27
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default H2 database and Qt Database support

    Hello,
    I have an H2 database that my qt app (c++) would like to connect to. I understand Qt has postges support in sql database module and according to H2 website
    "This database does not come with its own ODBC driver at this time, but it supports the PostgreSQL network protocol.".

    I was searching for some sample code but I am out of luck.

    Can somebody help me with link and clues on how to do this?

    Any help is appreciated much,
    baray98

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,590
    Thanks
    13
    Thanked 1,586 Times in 1,515 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: H2 database and Qt Database support

    It all seems to be here. Once you have the Postgres ODBC driver installed you use it from the Qt ODBC driver (not Postgres driver) like any other ODBC data source.

    That page implies that the Pg ODBC driver is 32-bit but there are also 64-bit version on the site the page links to. Your application will have to be compiled 32 or 64-bit to match.

  3. The following user says thank you to ChrisW67 for this useful post:

    baray98 (19th February 2020)

  4. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    5
    Platforms
    Unix/X11

    Default Re: H2 database and Qt Database support

    Quote Originally Posted by ChrisW67 View Post
    /.../ Once you have the Postgres ODBC driver installed you use it from the Qt ODBC driver (not Postgres driver) like any other ODBC data source.
    Does it mean, the QPSQL doesn't work ?

  5. #4
    Join Date
    Aug 2007
    Posts
    266
    Thanks
    27
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: H2 database and Qt Database support

    I will experiment and update this thread for feedback

  6. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,590
    Thanks
    13
    Thanked 1,586 Times in 1,515 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: H2 database and Qt Database support

    Quote Originally Posted by smyk View Post
    Does it mean, the QPSQL doesn't work ?
    That works if you are trying to talk to an actual Postgres database. It might work if this H2 database server looks enough like a Postgres database server. However, the H2 page explicitly says that you can reach it through the Postgres ODBC driver, which strongly suggests that a native Postgres connection will not.

  7. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    5
    Platforms
    Unix/X11

    Cool Re: H2 database and Qt Database support

    Quote Originally Posted by ChrisW67 View Post
    /.../ It might work if this H2 database server looks enough like a Postgres database server. However, the H2 page explicitly says that you can reach it through the Postgres ODBC driver, which strongly suggests that a native Postgres connection will not.
    Many ODBC drivers are just a wraper around the native API for the database server. I don't know the implementation details of the Postgres ODBC driver, but if both - the QPSQL and Postgres ODBC - internally use the Postgres API / Network protocol, it might be it works with QPSQL as well. I was hoping that maybe baray98 had tried it already

Similar Threads

  1. Replies: 0
    Last Post: 6th September 2018, 10:06
  2. Model/View programming support for database locks!
    By graciano in forum Qt Programming
    Replies: 1
    Last Post: 12th December 2013, 04:11
  3. Replies: 2
    Last Post: 27th August 2012, 04:27
  4. Qt to support XML database?
    By zhongzhu in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2009, 12:51
  5. Qt support for MS Access database
    By Gayathri in forum Qt Programming
    Replies: 1
    Last Post: 23rd November 2006, 14:14

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.