Results 1 to 11 of 11

Thread: Connecting Qt with PostgreSql

  1. #1
    Join Date
    Apr 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Connecting Qt with PostgreSql

    Hello guys, I don't write in English very well. Sorry me possible errors.

    I'm trying to connect PostgreSQL 9.1 with qt creator 4.7.3, but I don't able it.

    I search in the Google and I found some libs and dlls about several drivers (MySQL, SQLite(I had already), PostgreSQL and Firebird). The QtCreator now recognizes two drivers, SQLite and Firebird, but he doesn't found the PostgreSQL driver.

    For use Firebird driver I do nothing.

    I already search various locations and I can't do it run.

    Almost all tutorials I've found, have something like this:

    http://qt-project.org/doc/qt-4.8/sql-driver.html#qpsql

    But I can't to do this.

    Neither the directories they say I have here, even after I adjust the instalation location.

    Ps.: I already to copy the dll's for the right locations.

    Thanks,

    Jonathan.

  2. #2
    Join Date
    May 2010
    Posts
    19
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Connecting Qt with PostgreSql

    Hi jonathan,

    1. Copy the files qsqlpsql.dll and libqsqlpsql.a (depending on what you have compiled i.e debug/release) to your "plugins\sqldrivers" path in "QTDIR"
    2. Copy libeay32.dll,libintl-8.dll,libpq.dll and ssleay32.dll to your project directory

  3. #3
    Join Date
    Apr 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Connecting Qt with PostgreSql

    Quote Originally Posted by p3c0 View Post
    Hi jonathan,

    1. Copy the files qsqlpsql.dll and libqsqlpsql.a (depending on what you have compiled i.e debug/release) to your "plugins\sqldrivers" path in "QTDIR"
    2. Copy libeay32.dll,libintl-8.dll,libpq.dll and ssleay32.dll to your project directory
    Hi p3c0.

    I already did this and it's not work.

    Qt only recognizes two drivers still. =/

    I will end up reinstalling my Qt, for see if He work's right.

    Thanks very much for your answer.


    Added after 5 minutes:


    There is one compilation static or simple mode to compile this in my case?

    I'm searching it have three days. =x
    Last edited by JonathanVeg; 18th April 2012 at 13:38.

  4. #4
    Join Date
    Apr 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Connecting Qt with PostgreSql

    I don't understand this.

    Something I did, did the Qt recognize the driver, but he can't to load the driver.

    QSqlDatabase: QPSQL driver not loaded
    QSqlDatabase: available drivers: QFIREBIRD QSQLITE QPSQL7 QPSQL

    Someone have idea about this problem?

    Ps.: I don't want know what I did for the Qt recognize the driver.

    Thanks.

  5. #5
    Join Date
    May 2010
    Posts
    19
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Connecting Qt with PostgreSql

    can you tell the path where the file libeay32.dll,libintl-8.dll,libpq.dll and ssleay32.dll are present?
    It must be present in release directory of your project

  6. #6
    Join Date
    Apr 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Wink Re: Connecting Qt with PostgreSql

    The dlls are already in the folder where is my executable.

    I'm, now, using Firebird, because I'm a hurry for finish this program.

    After the finish it, I need to learn how to connect PostgreSQL.

    Thanks for answer me.

    I still need to learn it, but I think it's problem with my QTCreator.

    He is very instable, I don't know why.

    If you have new ideas, you can post, because I will return here

    In the worst, I will reinstalling my Qt and reconfigure it.

    Off-topic: How is my English? I'm brazilian and I'm studing English since last year. Make the questions here, in English, helps me to test it. I'm avoinding the Google Translate.

    No more, thanks for you help me.

  7. #7
    Join Date
    Apr 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default It worked!

    It worked!

    I found a free project in Qt with PostgreSQL and he has the correct DLLs for I use with my Qt.

    How more people should have the some question, I upload this archives for those who need.

    The link are http://sourceforge.net/projects/pedy...s.rar/download

    See you later.

  8. #8
    Join Date
    Apr 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Connecting Qt with PostgreSql

    Who know how I do for to connect the Postgresql in network?

    It works in localhost, but don't work in local network.

    I send IP, door, database name, username and password and never works.

    I already configure the especifics files for Postgres and nothing.

    Thanks.

  9. #9
    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: Connecting Qt with PostgreSql

    Two possibilities :
    - firewall on the PostgreSQL server computer
    - PostgreSQL configuration - entries in the file pg_hba.conf

    Take a look to PostgreSQL logs.

  10. #10
    Join Date
    Apr 2012
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Connecting Qt with PostgreSql

    Thanks.

    Now works.

    I do it.

  11. #11
    Join Date
    Dec 2009
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Connecting Qt with PostgreSql

    Hi, I'm not sure if I should open a new thread so I apologize if I had, but I have the same problem as Jonathan:

    QSqlDatabase: QPSQL driver not loaded
    QSqlDatabase: available drivers: QFIREBIRD QSQLITE QPSQL7 QPSQL

    I have win7 64 bit, postgresql 9.1, Qt 4.8.1, Qt creator 2.5
    In PATH variable I added bin folders of postgres and qt, postgres is installed in c:\pgsql (no problem with white spaces), and lib folder of postgres.
    I compiled Postgres sql driver plugin, I did it several times before, just this time it did not copy files automatically in qtdir/plugins/sqldrivers folder, I did it manually, i checked with QCoreApplication::libraryPaths(), it look in plugins folder where plugin resides, driver is availabile, I deleted plugin build keys from registry because I had previous installations of qt installed. Any suggestion is welcomed, thanks in advance.

    edit:
    I apologize for inconvenience but the problem after all is in my code, everything works now.Thank you nonetheless.
    Last edited by rajko; 20th May 2012 at 00:35.

Similar Threads

  1. connection QT with postgresql
    By khadija123 in forum Qt Programming
    Replies: 6
    Last Post: 31st March 2012, 22:09
  2. Replies: 2
    Last Post: 11th February 2011, 18:53
  3. Problem in connecting to PostgreSQL
    By c_srikanth1984 in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2009, 08:18
  4. requiredStatus on Qt 4.3 and PostgreSQL 8.3.3
    By Auryn in forum Qt Programming
    Replies: 9
    Last Post: 2nd September 2008, 23:06
  5. postgreSQL - Last Inserted ID
    By nnidza in forum Qt Programming
    Replies: 4
    Last Post: 2nd April 2007, 09:09

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.