Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. My exe app not connecting to database in other systems.
Forum Updated to NodeBB v4.3 + New Features

My exe app not connecting to database in other systems.

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 1.3k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    CEO.
    wrote on last edited by CEO.
    #1

    Laptop 1.
    My Python codes run well as expected without any error. It has a GUI built with PyQt5 with data stored in the database (Microsoft SQL server)

    I created exe (standalone) files which run very well. When I copy these exe files created in Laptop 1 to laptop 2, they work fine. Laptop 1 and Laptop 2 have Microsoft SQL server and Mysql server.

    Laptop 2:

    The same codes in Laptop 1 run well in Laptop 2. When I create exe files in Laptop 2, they run fine and connect to the database well. But when I copy the created exe files to other systems, they run well but don't get connected to the database.

    I've not tried copying them to Laptop 1 because presently I'm not with Laptop 1. I copied the exe files created in Laptop 2 to Laptop 3 (Laptop 3 doesn't have any SQL server), they run fine but don't get connected to the database.

    I shared the exe files to some of my friends who run them on their systems too. The apps open well but don't get connected to the database server.

    Does anyone know the reason for this?

    JonBJ 1 Reply Last reply
    0
    • C CEO.

      Laptop 1.
      My Python codes run well as expected without any error. It has a GUI built with PyQt5 with data stored in the database (Microsoft SQL server)

      I created exe (standalone) files which run very well. When I copy these exe files created in Laptop 1 to laptop 2, they work fine. Laptop 1 and Laptop 2 have Microsoft SQL server and Mysql server.

      Laptop 2:

      The same codes in Laptop 1 run well in Laptop 2. When I create exe files in Laptop 2, they run fine and connect to the database well. But when I copy the created exe files to other systems, they run well but don't get connected to the database.

      I've not tried copying them to Laptop 1 because presently I'm not with Laptop 1. I copied the exe files created in Laptop 2 to Laptop 3 (Laptop 3 doesn't have any SQL server), they run fine but don't get connected to the database.

      I shared the exe files to some of my friends who run them on their systems too. The apps open well but don't get connected to the database server.

      Does anyone know the reason for this?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @CEO
      We know nothing about how you create exe files for Python scripts. Some tool. Perhaps different situation in what it packages from laptop #1 versus #2, anyone's guess.

      To diagnose database connection failures: make sure you check returns results from database connection attempts, and print out whatever is supplied as "error message" when they fail.

      If you are using Qt's QSql... classes, set environment variable QT_DEBUG_PLUGINS=1 before you run your executable and look at the diagnostic output to see if failure.

      If you are using Python's own SQL modules use its documentation or ask in a Python forum.

      C 1 Reply Last reply
      0
      • JonBJ JonB

        @CEO
        We know nothing about how you create exe files for Python scripts. Some tool. Perhaps different situation in what it packages from laptop #1 versus #2, anyone's guess.

        To diagnose database connection failures: make sure you check returns results from database connection attempts, and print out whatever is supplied as "error message" when they fail.

        If you are using Qt's QSql... classes, set environment variable QT_DEBUG_PLUGINS=1 before you run your executable and look at the diagnostic output to see if failure.

        If you are using Python's own SQL modules use its documentation or ask in a Python forum.

        C Offline
        C Offline
        CEO.
        wrote on last edited by
        #3

        @JonB thanks for your contribution, but using "I" instead of "We" would have been better. Lol

        JonBJ 1 Reply Last reply
        0
        • C CEO.

          @JonB thanks for your contribution, but using "I" instead of "We" would have been better. Lol

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @CEO
          I did not notice you were the poster. You are right, everyone who reads this other than me knows just what you do to turn your python script into an "exe (standalone) file", because there is only one way to do that, and they know just what it entails. And they also know from your post whether you are using Qt functions to access the database or Python ones.

          C 1 Reply Last reply
          0
          • JonBJ JonB

            @CEO
            I did not notice you were the poster. You are right, everyone who reads this other than me knows just what you do to turn your python script into an "exe (standalone) file", because there is only one way to do that, and they know just what it entails. And they also know from your post whether you are using Qt functions to access the database or Python ones.

            C Offline
            C Offline
            CEO.
            wrote on last edited by
            #5

            @JonB now I am asking why the database can't be accessed from the other systems despite it being a standalone now

            JonBJ 1 Reply Last reply
            0
            • C CEO.

              @JonB now I am asking why the database can't be accessed from the other systems despite it being a standalone now

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @CEO

              @JonB said in My exe app not connecting to database in other systems.:

              If you are using Qt's QSql... classes, set environment variable QT_DEBUG_PLUGINS=1 before you run your executable and look at the diagnostic output to see if failure.
              If you are using Python's own SQL modules use its documentation or ask in a Python forum.

              Are you using QSql... classes (I can maybe help) or Python ones (I can't)?

              C 1 Reply Last reply
              0
              • JonBJ JonB

                @CEO

                @JonB said in My exe app not connecting to database in other systems.:

                If you are using Qt's QSql... classes, set environment variable QT_DEBUG_PLUGINS=1 before you run your executable and look at the diagnostic output to see if failure.
                If you are using Python's own SQL modules use its documentation or ask in a Python forum.

                Are you using QSql... classes (I can maybe help) or Python ones (I can't)?

                C Offline
                C Offline
                CEO.
                wrote on last edited by CEO.
                #7

                @JonB no, I'm not using QSql but Pyodbc, a library for connecting Python to Microsoft SQL server. Thanks for your follow-up

                mrjjM 1 Reply Last reply
                0
                • C CEO.

                  @JonB no, I'm not using QSql but Pyodbc, a library for connecting Python to Microsoft SQL server. Thanks for your follow-up

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #8

                  Hi

                  On laptop 2 , did you install the ODBC drivers

                  https://docs.microsoft.com/en-us/sql/connect/sql-connection-libraries?view=sql-server-ver15#anchor-20-drivers-relational-access

                  https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development?view=sql-server-ver15

                  as step 3 says.

                  C 1 Reply Last reply
                  1
                  • mrjjM mrjj

                    Hi

                    On laptop 2 , did you install the ODBC drivers

                    https://docs.microsoft.com/en-us/sql/connect/sql-connection-libraries?view=sql-server-ver15#anchor-20-drivers-relational-access

                    https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development?view=sql-server-ver15

                    as step 3 says.

                    C Offline
                    C Offline
                    CEO.
                    wrote on last edited by
                    #9

                    @mrjj I'm using pyodbc. In my connection, I stated the driver

                    mrjjM 1 Reply Last reply
                    0
                    • C CEO.

                      @mrjj I'm using pyodbc. In my connection, I stated the driver

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @CEO

                      yes but ODBC drivers are not installed by default
                      so make sure you have them on the other laptop if you didn't install SQL server there.
                      It might not be installed then.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved