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

Thread: use qpsql

  1. #1
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default use qpsql

    Hi everybody,
    QT: 4.1.3
    OS: WIN XP

    I tried to connect to my sql server via odbc and it works perfect. I have installed postgre 8.1 on my machine and build the plugin for postgre. I get a new file "qsqlpsql.dll". So i would like to connect it to a Postgre database. I get the known error: Driver not loaded, driver not loaded.
    Here my code:
    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
    2. db.setHostName("localhost");
    3. db.setDatabaseName("inventar");
    4. db.setUserName("postgres");
    5. db.setPassword("tekoteko");
    6. if(!db.open())
    7. {
    8. QMessageBox::information(this,"",db.lastError().text());
    9. return false;
    10. }
    11. else
    12. {
    13. . . .
    To copy to clipboard, switch view to plain text mode 

    What could i try to make my connection running?

    Thanks
    Think DigitalGasoline

  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: use qpsql

    Check the dependencies of the driver using dependency walker. Maybe the plugin can't find some library it needs.

  3. #3
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    Hi wysota!!
    I downloaded dependency walker and check qsqlpsql.dll
    I get a yellow question mark for "LIBPQ.dll", what should i do now?
    Last edited by raphaelf; 5th July 2006 at 12:41.
    Think DigitalGasoline

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Quote Originally Posted by raphaelf
    I get a yellow question mark for "LIBPQ.dll", what should i do now?
    Find it and copy to the same directory where the executable is.

  5. #5
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    Hi Jacek,
    I copyed the dll to the directory and i get the same error "driver not loaded"
    Think DigitalGasoline

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Quote Originally Posted by raphaelf
    I copyed the dll to the directory and i get the same error "driver not loaded"
    AFAIR you need more than one DLL. Check what DLLs libpq.dll requires.

  7. #7
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    Hi Jacek,
    I copied all dlls from postgres and i get the same error
    With QT3.2.1 i can remenber that i had no problem to connect me to my postgre database.
    Do QT4 support Postgre 8.1?
    What could i try now??
    Think DigitalGasoline

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Quote Originally Posted by raphaelf
    Do QT4 support Postgre 8.1?
    Of course it does. Which Qt version do you have exactly?

  9. #9
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    Hi!!
    QT4.1.3 Open Source Edition
    MINGW 4.1
    Think DigitalGasoline

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Quote Originally Posted by raphaelf
    QT4.1.3 Open Source Edition
    I had no problems with this version. To be able to load the plugin, I had to add libeay32.dll, libpq.dll and libssl32.dll

  11. #11
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    Hi everybody
    I add these dlls to my path: libeay32.dll, libpq.dll and qsqlpsql.dll
    I could not find libssl32.dll on my system.
    but i am not able to connect to my postgre databse. What could i try to solve my problem?

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
    2. db.setHostName("localhost");
    3. db.setDatabaseName("inventarMp");
    4. db.setUserName("postgres");
    5. db.setPassword("");
    6. if(!db.open())
    7. {
    8. QMessageBox::information(this,"",db.lastError().text());
    9. return false;
    10. }
    11. else
    12. {..
    To copy to clipboard, switch view to plain text mode 
    ERROR: Driver not loaded
    Think DigitalGasoline

  12. #12
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    hi everybody,
    can somebody see why i am not able to connect me to a postgre database

    thanks
    Think DigitalGasoline

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Where did you place the plugin and PostgreSQL DLLs?

  14. #14
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    hi jacek,
    i add libeay32.dll, libpq.dll and qsqlpsql.dll there where my .exe file is (in the release folder)

    have you a idea?
    Think DigitalGasoline

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Then move qsqlpsql.dll to the sqldrivers subdirectory.

  16. #16
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    hi jacek,
    this dll is allready under: D:\apps\Qt\4.1.3\plugins\sqldrivers
    Think DigitalGasoline

  17. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Quote Originally Posted by raphaelf
    this dll is allready under: D:\apps\Qt\4.1.3\plugins\sqldrivers
    Then copy it to the sqldrivers subdirectory of the directory where your executable is.

  18. #18
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    Hi Jacek,
    I create the sqldrivers directory, copy this dlls: libeay32.dll, libpq.dll, qsqlpsql.dll
    I get the same error message: DRIVER NOT LOAD DRIVER NOT LOAD
    Mission Impossible..
    Think DigitalGasoline

  19. #19
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: use qpsql

    Quote Originally Posted by raphaelf
    I create the sqldrivers directory, copy this dlls: libeay32.dll, libpq.dll, qsqlpsql.dll
    Only qsqlpsql.dll should go the sqldrivers, the rest should remain in the same directory where your executable is.

    Did you compile the plugin and Qt with the same compiler and same build key?

  20. #20
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: use qpsql

    Hi!
    I put just qsqlpsql.dll now in my sqldrivers directory.
    Yes i have compiled QT and Plugin with the same Compiler.

    What is a build key?
    Think DigitalGasoline

Similar Threads

  1. Qt 4.1.4 plugin QPSQL
    By jcr in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd June 2006, 23:55

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.