Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    [SOLVED]Connecting to database in Static build

    General and Desktop
    3
    6
    1630
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mbnoimi last edited by

      Hello,

      As I know static build preventing using database plug-in drivers.
      Is there any way to make my application connecting to the database with static build?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Have a look at the "plugin":http://qt-project.org/doc/qt-4.8/plugins-howto.html#static-plugins documentation

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • M
          mbnoimi last edited by

          [quote author="SGaist" date="1366196645"]Hi,

          Have a look at the "plugin":http://qt-project.org/doc/qt-4.8/plugins-howto.html#static-plugins documentation[/quote]

          I added the plugins as mentioned above during configuration process:
          [code]./configure -static -developer-build -v -qt-sql-psql -qt-sql-sqlite -plugin-sql-psql -plugin-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -qt-pcre -qt-xcb[/code]

          PS
          I'm using Qt 5.0.2

          1 Reply Last reply Reply Quote 0
          • C
            Code_ReaQtor last edited by

            Plugin works with "shared/dll" builds. However, if you built Qt from source in "static" mode, you may still connect to a database - database plugins will be added to QtSql.lib/QtSqld.lib (I think).

            There is also another option, use "QSqlDatabase::registerSqlDriver":http://qt-project.org/doc/qt-4.8/qsqldatabase.html#registerSqlDriver if you have a custom Sql Driver. I wrote a "blog":http://qtsimplify.blogspot.com/ on that thing 2 days ago if you need a reference.

            Please visit my open-source projects at https://github.com/Code-ReaQtor.

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              You can find a similar document for Qt5

              Did you update the pro file and your code to make use of the plugins you need ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply Reply Quote 0
              • M
                mbnoimi last edited by

                Sorry guys.. my mistake I forgot to add the following to my .pro file

                [code]QTPLUGIN += qsqlpsql[/code]

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post