Results 1 to 12 of 12

Thread: QtService & QtSql

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    18
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QtService & QtSql

    That's not exactly the problem here: our programs work flawlessly when executed as standalone applications. I use the default version of Qt, I've compiled the MySQL driver as that website says, and everything runs fine on a regular Qt4 application.

    The problem is trying to run a QtService with the MySQL plugin, as the service won't find the plugin. A possible solution would be to recompile Qt4 with -qt-sql-driver, but that'd be really time consuming and I was looking for a quicker solution.

  2. #2
    Join Date
    Nov 2011
    Posts
    9
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: QtService & QtSql

    Do you deploy the service in Windows or in unix ?
    If you manage to compile using -qt-sql-mysql please tell me how It seems that I cannot manage to compile using nmake...

  3. #3
    Join Date
    Dec 2010
    Posts
    18
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QtService & QtSql

    I'm working on Windows right now, but with mingw, not with msvc. I once managed to compile with -qt-sql-mysql, but I was cross-compiling on Linux for QtEmbedded.

  4. #4
    Join Date
    Dec 2010
    Posts
    18
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QtService & QtSql

    Hm, actually, it works like a charm in release, it only fails on debug, so there must be something fishy with my debug libraries...

  5. #5
    Join Date
    Nov 2011
    Posts
    9
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: QtService & QtSql

    Probably you already know that on debug it searches for qsqlmysql4.dll with d in the name: qsqlmysqld4.dll or something.

  6. #6
    Join Date
    Dec 2010
    Posts
    18
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QtService & QtSql

    Indeed, but for some reason it won't find my sqldrivers/qsqlmysqld4.dll, go figure...

  7. #7
    Join Date
    Oct 2014
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QtService & QtSql

    Try this, it works for me.


    int main(int argc, char *argv[])
    {
    QString app_path = QFileInfo(QString::fromLocal8Bit(argv[0])).absolutePath();
    QCoreApplication::addLibraryPath(app_path);

    OpcService service(argc, argv);
    return service.exec();
    }


    And copy qsqlmysql4.dll to "sqldrivers" subdirectory of your .exe file.

Similar Threads

  1. QtService Library (dll) for windows
    By ruben.rodrigues in forum Installation and Deployment
    Replies: 1
    Last Post: 22nd October 2010, 19:18
  2. QtService on Windows as Non-Interactive
    By stefanadelbert in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2010, 03:27
  3. Help on QTcpSocket, QTService and QThread
    By josecarlosmissias in forum Newbie
    Replies: 1
    Last Post: 12th November 2009, 16:37
  4. QtService fails to start
    By a550ee in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2006, 13:34
  5. QtService and GAC loadable dll
    By stevey in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2006, 03:39

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.