Results 1 to 20 of 24

Thread: PostgreSQL and Windows Community Version

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    40
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL and Windows Community Version

    I ran Dependency Walker on the application, when I run it on the dll I get the following error:

    At least one required implicit or forward dependency was not found.

    This was for, I believe, LIBPQ.DLL, I do not get this error when I try the other plugins. So I guess this is teh problem, but I'm still unceratn where to go from here, although it does give me something to Google.

    The application was origianlly in debug mode, I now have it in release mode, but no difference.

  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: PostgreSQL and Windows Community Version

    Quote Originally Posted by graeme
    This was for, I believe, LIBPQ.DLL, I do not get this error when I try the other plugins.
    It looks like it can't find the PostgreSQL client library. Find that file and copy it to the same directory where your executable is (you might need other DLLs too, so check it with Dependency Walker).

  3. #3
    Join Date
    Jan 2006
    Posts
    40
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL and Windows Community Version

    Just done that and whilst Dependency Walker is now happy, my app refuses to play ball

    I have now put the driver along with the dlls in the plugin directory and in an sqldrivers directory in the same direcotiry as the executable but no joy.

  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: PostgreSQL and Windows Community Version

    Quote Originally Posted by graeme
    I have now put the driver along with the dlls in the plugin directory and in an sqldrivers directory in the same direcotiry as the executable but no joy.
    Are you 100% sure that both the plugin and the application were built in the same mode (i.e. both in debug mode or both in release mode)?

  5. #5
    Join Date
    Jan 2006
    Posts
    40
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL and Windows Community Version

    I have both versions of the plugin qsqlpsql.dll & qsqlpsqld.dll.
    I tried with a release version of my app, followed by a debug version. I currently have a debug version.
    The postgresql dll are (I believe) release versions (no *d.dll)

    Should I just revert to the release version of the app?

  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: PostgreSQL and Windows Community Version

    Quote Originally Posted by graeme
    Should I just revert to the release version of the app?
    No, since you have both versions of the plugin.

    What does exactly QSqlDatabase::drivers() return when you invoke it from your application? What parameters do you pass to QSqlDatabase::addDatabase()?

  7. #7
    Join Date
    Jan 2006
    Posts
    40
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL and Windows Community Version

    drivers returns:

    QSQLITE
    QODBC3
    QODBC

    The code you requested is:
    Qt Code:
    1. // Get the connection, if it exists
    2. QSqlDatabase dbConn = QSqlDatabase::database(connName,false);
    3. // Check that the driver is available
    4. if (!QSqlDatabase::isDriverAvailable(connType))
    5. throw sqlE(dbConn, QObject::tr("The Database driver ")+ connType + QObject::tr("is not available"));
    To copy to clipboard, switch view to plain text mode 

    followed by:

    Qt Code:
    1. // Okay the connection doesn't exist so let's add it using the appropriate driver type
    2. dbConn = QSqlDatabase::addDatabase(connType,connName);
    To copy to clipboard, switch view to plain text mode 
    The result is "... The Database driver QPSQLis not available"
    Last edited by graeme; 17th April 2006 at 20:22.

  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: PostgreSQL and Windows Community Version

    This is weird. I've never had any problems with QPSQL driver on windows.

    Quote Originally Posted by graeme
    qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\ms\libpq.lib" psql.pro
    ...
    This generated .a and .dll files in the C:\Qt\4.1.1\plugins\sqldrivers directory.
    What compiler do you use? I guess you use MinGW, if you got an .a file, but then you shouldn't be able to use the libpq.lib file.

    Try:
    qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib" psql.pro

  9. #9
    Join Date
    Jan 2006
    Posts
    40
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL and Windows Community Version

    I'm using Mingw32

    The switch you suggest gives an error:

    C:\psql\lib: No such file

    following you line of thought (I believe) I tried

    qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\libpq.a" psql.pro

    that created the files but still nothing when I run the program

  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: PostgreSQL and Windows Community Version

    Quote Originally Posted by graeme
    following you line of thought (I believe) I tried
    qmake -o Makefile "INCLUDEPATH+=C:\psql\include" "LIBS+=C:\psql\lib\libpq.a" psql.pro
    Yes, or "LIBS+= -LC:\psql\lib\ -lpq".

    Quote Originally Posted by graeme
    that created the files but still nothing when I run the program
    I hope you have removed all copies of the old driver.

    I always configure Qt like this:
    configure -L C:\...\psql\lib -I C:\...\psql\include -plugin-sql-psql ...
    Which Qt version do you use exactly? In one of the older versions one had to remove some keys from the registry in case of problems with plugins. It was something around HKEY_CURRENT_USER\Software\Trolltech\OrganizationD efaults\Qt Plugin Cache...

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

    Default Re: PostgreSQL and Windows Community Version

    I'm using 4.1.1

    I removed the old drivers, in fact I renamed the old file ran my program - no drivers. Copied the qsqlited.dll into the sqldrivers folder of my app it found that driver. Removed it - no drivers.

    Then ran the make. It created a new sqldrivers directory with the new psql driver. I copied it into my program sqldrivers directory and deleted it from the qt directory. But alas...

    I'll look for the registry entry.

  12. #12
    Join Date
    Jan 2006
    Posts
    40
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL and Windows Community Version

    The registry only has the default value

  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: PostgreSQL and Windows Community Version

    Quote Originally Posted by graeme
    I'm using 4.1.1
    ...
    I'll look for the registry entry.
    If there was a problem with loading the driver Qt marked such plugin as invalid in the registry and then just ignored it (even after the problem was fixed), but AFAIR this was Qt 4.0.0 or 4.0.1.

Similar Threads

  1. Qt and PostgreSQL : version not supported
    By xinevil in forum Qt Programming
    Replies: 1
    Last Post: 10th July 2008, 13:00

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
  •  
Qt is a trademark of The Qt Company.