Results 1 to 7 of 7

Thread: QT4 and Postgresql driver

  1. #1
    Join Date
    Feb 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default QT4 and Postgresql driver

    Hi guys,

    i'have tried to compile QT with option -qt-sql-psql or -plugin-sql-psql but each time it fails!
    I am using QT 4.1.0 on a win XP box, Postgresql 8.0.6, and MinGW as a compiler.

    first i run :
    configure -I C:\psql\8.0\include -qt-sql-psql

    and it works fine! (at least without any error)

    and then i run :
    mingw32-make (to start compiling QT)

    after several minutes it shows this error :
    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: cannot find -lpq
    collect2: ld returned 1 exit status
    mingw32-make[3]: *** [..\..\lib\QtSqld4.dll] Error 1

    can anyone help me?

  2. #2
    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: QT4 and Postgresql driver

    Try: configure -I C:\psql\8.0\include -L C:\psql\8.0\lib -qt-sql-psql

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

    yuniarto.rahardjo (24th November 2008)

  4. #3
    Join Date
    Feb 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT4 and Postgresql driver

    thanks a lot, it worked fine (compiling and acces to database either localhost and remotehost).

    I have one (or two) more questions:

    Q1 : My application must be installed in another box (win XP), how can put the plugin with, in order to access to the database from that box?

    Q2 : I have tried to compile Qt with -plugin-sql-psql option, it worked fine and it generated 2 DLLs qsqlpsql.dll and qsqlpsqld.dll, i put them in my application rootdir, but no success, the message displayed in QSqlError.text() is "Driver not loaded Driver not loaded"
    How can i use the plugin to access to Postgresql?

    thanks a lot

    ----------------
    sorry if my questions aren't interesting

  5. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QT4 and Postgresql driver

    Look here
    same problem
    a life without programming is like an empty bottle

  6. #5
    Join Date
    Feb 2006
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT4 and Postgresql driver

    thank u zlatko, i have already read this thread.
    let me explain what problem i currently have :

    first i ran :
    configure -I c:\psql\8.0\include -L c:\psql\8.0\lib -qt-sql-psql (thanks to Jacek)
    then minwg32-make
    this worked fine and i can connect to database without any problem

    second in another box(same configuration) i ran :
    configure -I c:\psql\8.0\include -L c:\psql\8.0\lib -plugin-sql-psql
    then minwg32-make.
    no error after compiling, but when i launch the application QSqlError.text() has : "Driver not loaded Driver not loaded"

    in the thread u quoted, raphael could make his application run with the plugin.

    i hope this explaination is clear to you.

  7. #6
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QT4 and Postgresql driver

    If you create folder sqldrivers and put it driver dll he must be loaded, else i dont know how i can help you....becose this thread repeated in forum more times
    a life without programming is like an empty bottle

  8. #7
    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: QT4 and Postgresql driver

    Quote Originally Posted by alphaqt
    no error after compiling, but when i launch the application QSqlError.text() has : "Driver not loaded Driver not loaded"
    Where did that plugin land? In %QTDIR%/plugins/sqldrivers? Where are PostgreSQL DLLs*? Did you try to copy them to the same directory where the executable is?

    * AFAIR you need at least libpq.dll, iconv.dll, ssleay.dll and crypto.dll (names could be slightly different, as I don't remeber them well). Use try the Dependency Walker it will show you if your program can't find some libraries.

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.