Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. How to access a DB that is on a remote server?
Forum Updated to NodeBB v4.3 + New Features

How to access a DB that is on a remote server?

Scheduled Pinned Locked Moved Unsolved The Lounge
14 Posts 9 Posters 2.2k Views 2 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.
  • U Offline
    U Offline
    U7Development
    wrote on 23 Feb 2020, 17:29 last edited by
    #1

    Hi mates...

    In the past was really easy to setup a server using IIS on Windows on a Web based server, where all clients access via browser using a dyndns url, i only needed to forward port 81 to get access to my web site.

    Now, with Qt, i have done my client as a desktop application, so as you can see, i guess there is nothing to do with port 80, 81 etc...

    The web-based client flow is : internet client via web browser -> server web browser -> database.

    In Desktop is direct : internet client desktop -> server database

    My Server in this case has MariaDB using port number 3306, root & pass and a no-ip url to get from outside.. No-IP is already setup and working, but i have no idea how i need to configure my server to make it listen my outside client... Do i still need to forward the server lan ip on the router?..

    Thanks in advance.

    A 1 Reply Last reply 24 Feb 2020, 14:57
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Feb 2020, 19:53 last edited by
      #2

      Hi,

      Do you mean you want it make your database facing internet directly ?

      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
      1
      • U Offline
        U Offline
        U7Development
        wrote on 24 Feb 2020, 14:37 last edited by
        #3

        Hi, yes, a remote client accessing directly to a database that is hosted on a remote server. Web based applications do not do this instead the server side app is the middleware between client and database, but in my case is direct...

        1 Reply Last reply
        0
        • A Offline
          A Offline
          artwaw
          wrote on 24 Feb 2020, 14:49 last edited by artwaw
          #4

          Hi,
          apart from what I think of exposing any db directly to the internet in order to get access from Qt based application you just need to provide necessary data to the QSqlDatabase instance:

          • public ip address (or url) of the database;
          • port;
          • username and password;
          • all others optional parameters.

          It is all described in the documentation.

          For more information please re-read.

          Kind Regards,
          Artur

          1 Reply Last reply
          4
          • U U7Development
            23 Feb 2020, 17:29

            Hi mates...

            In the past was really easy to setup a server using IIS on Windows on a Web based server, where all clients access via browser using a dyndns url, i only needed to forward port 81 to get access to my web site.

            Now, with Qt, i have done my client as a desktop application, so as you can see, i guess there is nothing to do with port 80, 81 etc...

            The web-based client flow is : internet client via web browser -> server web browser -> database.

            In Desktop is direct : internet client desktop -> server database

            My Server in this case has MariaDB using port number 3306, root & pass and a no-ip url to get from outside.. No-IP is already setup and working, but i have no idea how i need to configure my server to make it listen my outside client... Do i still need to forward the server lan ip on the router?..

            Thanks in advance.

            A Offline
            A Offline
            artwaw
            wrote on 24 Feb 2020, 14:57 last edited by
            #5

            @U7Development also, you wrote:

            My Server in this case has MariaDB using port number 3306, root & pass and a no-ip url to get from outside.. No-IP is already setup and working, but i have no idea how i need to configure my server to make it listen my outside client... Do i still need to forward the server lan ip on the router?
            

            My understanding is that you have the server on the LAN somewhere and would like to connect remotely over the Internet?
            In this case you need to forward the port of the DB from the outside (the internet) to point into your server's ip (inside) on your router. This can be done as a simple port forwarding/triggering in simpler models of the routers.

            To connect you'll need to know public IP (or URL should you have one) of the router and use this to connect. That kind of setup might be tricky though if you have dynamic IP address on the router (and setting this up is a bit outside of topics on this forum).

            For more information please re-read.

            Kind Regards,
            Artur

            U 1 Reply Last reply 24 Feb 2020, 15:06
            3
            • A artwaw
              24 Feb 2020, 14:57

              @U7Development also, you wrote:

              My Server in this case has MariaDB using port number 3306, root & pass and a no-ip url to get from outside.. No-IP is already setup and working, but i have no idea how i need to configure my server to make it listen my outside client... Do i still need to forward the server lan ip on the router?
              

              My understanding is that you have the server on the LAN somewhere and would like to connect remotely over the Internet?
              In this case you need to forward the port of the DB from the outside (the internet) to point into your server's ip (inside) on your router. This can be done as a simple port forwarding/triggering in simpler models of the routers.

              To connect you'll need to know public IP (or URL should you have one) of the router and use this to connect. That kind of setup might be tricky though if you have dynamic IP address on the router (and setting this up is a bit outside of topics on this forum).

              U Offline
              U Offline
              U7Development
              wrote on 24 Feb 2020, 15:06 last edited by
              #6

              @artwaw

              Thanks Artur...
              So practically the only thing i need to do is to portforward port 3306 for the server ip on LAN 192.168.1.200 and automagically DB will be available for remote Qt desktop client isn't ?

              A 1 Reply Last reply 24 Feb 2020, 15:12
              0
              • U U7Development
                24 Feb 2020, 15:06

                @artwaw

                Thanks Artur...
                So practically the only thing i need to do is to portforward port 3306 for the server ip on LAN 192.168.1.200 and automagically DB will be available for remote Qt desktop client isn't ?

                A Offline
                A Offline
                artwaw
                wrote on 24 Feb 2020, 15:12 last edited by artwaw
                #7

                @U7Development In theory, yes. In practice there still might be network issues preventing successful connection (that kind of setup is quite complicated to debug as there might be both software compatibility issues and routing issues on the network). Try it, see if it works.
                Also, if your router permits any kind of logging it might be worth settings this up to monitor network connectivity - especially with regards to port forwarding.
                Side note - please check if your router allows exposing "applications" to the outside interface, some built in router firewalls have that option. From my experience using this option in the router firewall works more often than simple port forwarding.
                As I said, there are multiple non-exclusive points of failure in that kind of setup.

                For more information please re-read.

                Kind Regards,
                Artur

                U 1 Reply Last reply 24 Feb 2020, 15:41
                4
                • A artwaw
                  24 Feb 2020, 15:12

                  @U7Development In theory, yes. In practice there still might be network issues preventing successful connection (that kind of setup is quite complicated to debug as there might be both software compatibility issues and routing issues on the network). Try it, see if it works.
                  Also, if your router permits any kind of logging it might be worth settings this up to monitor network connectivity - especially with regards to port forwarding.
                  Side note - please check if your router allows exposing "applications" to the outside interface, some built in router firewalls have that option. From my experience using this option in the router firewall works more often than simple port forwarding.
                  As I said, there are multiple non-exclusive points of failure in that kind of setup.

                  U Offline
                  U Offline
                  U7Development
                  wrote on 24 Feb 2020, 15:41 last edited by
                  #8

                  @artwaw yes, agreed... i need to contact to my ISP to check if my modem-router is enabled to port forwarding or permit access from outside by firewall as you said..... otherwise i will need to buy a custom router and set ISP modem to Bridge..

                  Thanks !

                  jsulmJ 1 Reply Last reply 25 Feb 2020, 06:36
                  0
                  • U U7Development
                    24 Feb 2020, 15:41

                    @artwaw yes, agreed... i need to contact to my ISP to check if my modem-router is enabled to port forwarding or permit access from outside by firewall as you said..... otherwise i will need to buy a custom router and set ISP modem to Bridge..

                    Thanks !

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 25 Feb 2020, 06:36 last edited by
                    #9

                    @U7Development You should seriously rethink your approach - exposing databases directly to the Internet isn't a good idea...

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    4
                    • B Offline
                      B Offline
                      Bur8rus
                      Banned
                      wrote on 9 Apr 2020, 20:42 last edited by Bur8rus 4 Sept 2020, 20:42
                      #10
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        Pollock95
                        Banned
                        wrote on 22 May 2021, 11:02 last edited by Pollock95
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • F Offline
                          F Offline
                          Fugate251
                          Banned
                          wrote on 7 Jun 2021, 09:30 last edited by
                          #12
                          This post is deleted!
                          1 Reply Last reply
                          1
                          • D Offline
                            D Offline
                            David142
                            Banned
                            wrote on 24 Jun 2021, 08:24 last edited by
                            #13
                            This post is deleted!
                            1 Reply Last reply
                            0
                            • Christian EhrlicherC Online
                              Christian EhrlicherC Online
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on 24 Jun 2021, 08:31 last edited by
                              #14

                              Locking this topic - attracts spammers.

                              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                              Visit the Qt Academy at https://academy.qt.io/catalog

                              1 Reply Last reply
                              1

                              • Login

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