Results 1 to 5 of 5

Thread: can not use PSQL driver on windows7 machine

  1. #1
    Join Date
    Jan 2011
    Posts
    32
    Thanks
    11
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default can not use PSQL driver on windows7 machine

    This is the code for the connection:

    Qt Code:
    1. bool createPostgreSQLConnection()
    2. {
    3. qDebug() << "--------------------";
    4. qDebug() << "Postgree connection";
    5. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL7");
    6. qDebug() << "DRIVERS :" << QSqlDatabase::drivers();
    7. db.setHostName("127.0.0.1");
    8. db.setDatabaseName("DatabaseName");
    9. db.setPassword("Password");
    10. db.setUserName("UserName");
    11.  
    12. if (!db.open()) {
    13. qDebug()<< db.lastError().text();
    14. return false;
    15. }
    16. return true;
    17. }
    To copy to clipboard, switch view to plain text mode 

    This files I got after compilation of plugin:
    libqsqlpsql4.a
    libqsqlpsqld4.a
    qsqlpsql4.dll
    qsqlpsqld4.dll

    I copied this files in {QTPath}\plugins\sqldrivers and I still get this error:
    --------------------
    Postgree connection
    QSqlDatabase: QPSQL7 driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
    DRIVERS : ("QSQLITE", "QODBC3", "QODBC")
    "Driver not loaded Driver not loaded"

    I have no idea what could be the problem.

    Earlier today I do the same for ODBC driver(compile, copy in the folder and build application) and everything was working fine.
    Could you help me?


    Note: I use mingw32-make from QT distribution
    Last edited by mak_user; 25th May 2011 at 20:31.

  2. #2
    Join Date
    Jan 2011
    Posts
    32
    Thanks
    11
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: can not use PSQL driver on windows7 machine

    Does anyone work successfully with PostgreSQL under windows7 or should I stop trying?

  3. #3
    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: can not use PSQL driver on windows7 machine

    Did You have installed PostgreSQL on Windows 7 ? If not You must copy to app dir PostgreSQL dll's to.

  4. #4
    Join Date
    Jan 2011
    Posts
    32
    Thanks
    11
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: can not use PSQL driver on windows7 machine

    Sure I have installed PostgreSQL. I can work on the tables with pgAdmin III.
    What dll's are you talking about?


    Added after 4 minutes:


    Last thing I did is followed this instruction to build plugins http://www.qtcentre.org/wiki/index.p...ws_using_MinGW. I build plugins successufully again and QPSQL driver is still not loaded.

    ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function 'virtual QSqlIndex QPSQLDriver:rimaryIndex(const QString&) const':
    ..\..\..\sql\drivers\psql\qsql_psql.cpp:979: warning: enumeration value 'VersionUnknown' not handled in switch
    ..\..\..\sql\drivers\psql\qsql_psql.cpp: In member function 'virtual QSqlRecord QPSQLDriver::record(const QString&) const':
    ..\..\..\sql\drivers\psql\qsql_psql.cpp:1056: warning: enumeration value 'VersionUnknown' not handled in switch

    This are the warnings I got while compileing plugins. I have no idea how to proceed. Maybe you can help me.
    Last edited by mak_user; 26th May 2011 at 11:46.

  5. #5
    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: can not use PSQL driver on windows7 machine

    DLL's from POSTGRESQL_DIR\bin. Plugin use them to connect to server.
    PostgreSQL plugin IS working on Windows 7.
    We are working with MS Visual C++.

  6. The following user says thank you to Lesiok for this useful post:

    mak_user (27th May 2011)

Similar Threads

  1. How to load PSQL Driver for QT in Ubuntu
    By Srinivas_30sep in forum Newbie
    Replies: 2
    Last Post: 8th April 2011, 14:30
  2. Qt winXP binary on windows7?
    By Teuniz in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2010, 19:35
  3. Qt 4.7.1 on Windows7 (64Bit)
    By caius9090 in forum Installation and Deployment
    Replies: 1
    Last Post: 18th November 2010, 22:59
  4. Replies: 2
    Last Post: 22nd December 2009, 20:52
  5. psql driver and s60
    By [maTa] in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th October 2009, 22:16

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.