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. How to connect database to online service
Forum Updated to NodeBB v4.3 + New Features

How to connect database to online service

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 4 Posters 5.0k Views 3 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.
  • Thank YouT Thank You

    @mrjj

    One way is to use dockers.

    I am somewhat aware about it. But main thing is
    My computer doesn't support it. I don't have virtualization in this PC.(So can't learn here) I will get new laptop within 2 months I guess. Currently It runs in Intel Dual Core 2.

    Even the pc that plays server dies.

    I am sure there will be no problem with it.
    I will run Xampp in the client machine. It runs pretty well in my machine. So that speed is sufficient for me.
    It will run in about 12 machines.

    However, what is the setup?
    Do you have an real server already or you must provide one ?

    No just windows machine. Nothing specific. If we need more user. They can give me different PC for hosting database(may be after using it for 2 months). So Xampp is best I guess for now.

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

    @Thank-You said in How to connect database to online service:

    Intel Dual Core 2.

    Wow thats a pretty old one.
    As far as I can recall, you can run virtual box on it 32 bit.
    but 64 bit demands VT-x.

    However, if Xampp works fine, i would just go with that. 12 clients is not that much.

    Thank YouT 1 Reply Last reply
    0
    • mrjjM mrjj

      @Thank-You said in How to connect database to online service:

      Intel Dual Core 2.

      Wow thats a pretty old one.
      As far as I can recall, you can run virtual box on it 32 bit.
      but 64 bit demands VT-x.

      However, if Xampp works fine, i would just go with that. 12 clients is not that much.

      Thank YouT Offline
      Thank YouT Offline
      Thank You
      wrote on last edited by
      #9

      @mrjj

      As far as I can recall, you can run virtual box on it 32 bit.

      Wow, Really I didn't know about that.

      Do you have any idea how can I do that?😂😂

      Let's make QT free or It will go forever

      TRUE AND FALSE <3

      mrjjM 1 Reply Last reply
      0
      • Thank YouT Thank You

        @mrjj

        As far as I can recall, you can run virtual box on it 32 bit.

        Wow, Really I didn't know about that.

        Do you have any idea how can I do that?😂😂

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

        @Thank-You

        Well if you download virtual box and
        create a new virtual machine for 32-bit linux.
        Not all distros have 32 bit anymore.

        then
        From the VirtualBox Manager, find the Enable Nested VT-x/AMD-V check box on the Processor tab. To disable the feature, deselect the check box.

        then you can run most 32-bit linux or windows.
        just make sure mysql or Xampp is 32 bit

        To fast test if it still work you can grab a 32 bit win 7 here and test with
        https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

        Thank YouT 1 Reply Last reply
        1
        • mrjjM mrjj

          @Thank-You

          Well if you download virtual box and
          create a new virtual machine for 32-bit linux.
          Not all distros have 32 bit anymore.

          then
          From the VirtualBox Manager, find the Enable Nested VT-x/AMD-V check box on the Processor tab. To disable the feature, deselect the check box.

          then you can run most 32-bit linux or windows.
          just make sure mysql or Xampp is 32 bit

          To fast test if it still work you can grab a 32 bit win 7 here and test with
          https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

          Thank YouT Offline
          Thank YouT Offline
          Thank You
          wrote on last edited by Thank You
          #11

          @mrjj
          Hello Sir,
          I have finalized my thoughts and thought to use Xampp.
          I am stuck in small problem.
          It's middle night here. But still I can't find any solutions of it.(Almost searched about this topic for 5-6 hours)

          I have hosted on 192.168.100.8 But I want to make it fixed that it won't change.
          Like just hosting database on 192.168.100.8 wherever I am connected In (local network, I should be able to access the port from another computer on the same network).
          How can I make it host to fixed private Ip in LAN at any time
          Or
          Will it change overtime If so how can I solve this problem.

          Let's make QT free or It will go forever

          TRUE AND FALSE <3

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #12

            Hi,

            Use a proper DNS and name your server appropriately. Otherwise you have to make the address static.

            In any case, you have to take another thing into account, if you want to connect to your database through the internet, you should really consider implementing a proper service that will shield the database from the internet.

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

            Thank YouT 1 Reply Last reply
            1
            • SGaistS SGaist

              Hi,

              Use a proper DNS and name your server appropriately. Otherwise you have to make the address static.

              In any case, you have to take another thing into account, if you want to connect to your database through the internet, you should really consider implementing a proper service that will shield the database from the internet.

              Thank YouT Offline
              Thank YouT Offline
              Thank You
              wrote on last edited by
              #13

              @SGaist

              Yup, But main thing is I am not able to communicate to server.
              I have hosted it successfully. But can't connect to server

              I can go to

              192.168.100.4:8080/phpmyadmin

              and it shows as expected. But when I try to connect to database It fails
              saying

              53a55e2f-2888-46f7-ba79-90f09606931c-image.png

                 db.setDatabaseName("users");
                 db.setPort(8080);
                 db.setHostName("192.168.100.4");
                 db.setUserName("root");
                 db.setPassword("");
              

              What do you think the problem is?

              Let's make QT free or It will go forever

              TRUE AND FALSE <3

              mrjjM 1 Reply Last reply
              0
              • Thank YouT Thank You

                @SGaist

                Yup, But main thing is I am not able to communicate to server.
                I have hosted it successfully. But can't connect to server

                I can go to

                192.168.100.4:8080/phpmyadmin

                and it shows as expected. But when I try to connect to database It fails
                saying

                53a55e2f-2888-46f7-ba79-90f09606931c-image.png

                   db.setDatabaseName("users");
                   db.setPort(8080);
                   db.setHostName("192.168.100.4");
                   db.setUserName("root");
                   db.setPassword("");
                

                What do you think the problem is?

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

                @Thank-You
                Hi
                try with port 3306.

                You are using port 8080 for
                db.setPort(8080);

                but is that not the port the web server uses ?
                so while 192.168.100.4:8080/phpmyadmin Works, that is the port the web server answers
                and not to mysql clients.

                Also make sure port 3306 is not blocked by windows firewall.

                https://dev.mysql.com/doc/mysql-port-reference/en/mysql-ports-reference-tables.html

                Thank YouT 1 Reply Last reply
                3
                • mrjjM mrjj

                  @Thank-You
                  Hi
                  try with port 3306.

                  You are using port 8080 for
                  db.setPort(8080);

                  but is that not the port the web server uses ?
                  so while 192.168.100.4:8080/phpmyadmin Works, that is the port the web server answers
                  and not to mysql clients.

                  Also make sure port 3306 is not blocked by windows firewall.

                  https://dev.mysql.com/doc/mysql-port-reference/en/mysql-ports-reference-tables.html

                  Thank YouT Offline
                  Thank YouT Offline
                  Thank You
                  wrote on last edited by
                  #15

                  @mrjj
                  Yes, I actually got success after seeing this thing for almost day.

                     db.setDatabaseName("users");
                     db.setPort(9906);
                  // It  is 9906 because I changed from 3306 to 9906 before some time due to some errors
                     db.setHostName("192.168.100.4");
                     db.setUserName("host");
                     db.setPassword("");
                  

                  I first did what you said

                  changed to 9906(port)

                  And I got the error
                  322a9fd6-006e-401a-8c2e-4e15d0675ce2-image.png

                  Then I created new privileges to all address

                  Now It's finally done!

                  Ok I made it work but Are there security risks in this situation(simple only) ?
                  Another question for you

                  Will private IP change overtime.

                  If so there will be problem because the database won't be hosted if IP changes.
                  Am I right?. Or
                  It will be hosted on the same port?

                  Let's make QT free or It will go forever

                  TRUE AND FALSE <3

                  mrjjM SGaistS 2 Replies Last reply
                  0
                  • Thank YouT Thank You

                    @mrjj
                    Yes, I actually got success after seeing this thing for almost day.

                       db.setDatabaseName("users");
                       db.setPort(9906);
                    // It  is 9906 because I changed from 3306 to 9906 before some time due to some errors
                       db.setHostName("192.168.100.4");
                       db.setUserName("host");
                       db.setPassword("");
                    

                    I first did what you said

                    changed to 9906(port)

                    And I got the error
                    322a9fd6-006e-401a-8c2e-4e15d0675ce2-image.png

                    Then I created new privileges to all address

                    Now It's finally done!

                    Ok I made it work but Are there security risks in this situation(simple only) ?
                    Another question for you

                    Will private IP change overtime.

                    If so there will be problem because the database won't be hosted if IP changes.
                    Am I right?. Or
                    It will be hosted on the same port?

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

                    Hi

                    • Ok I made it work but Are there security risks in this situation(simple only) ?

                    Depends on what you did. if you allowed this port in the firewall on the internal network/pc
                    its ok. That's how one normally allows new traffic on a port.

                    • Will private IP change overtime.

                    Yes. if done by the local DHCP server then yes unless some IT dude promised you
                    it would not. You can be lucky that it will get the same IP for a long time.

                    • If so there will be problem because the database won't be hosted if IP changes.

                    well if the IP changes then the clients cant find the server anymore.

                    But I don't know your LAN. if it's not a home setup then you most likely also have a DNS server and that means you can use a name instead of an IP. the DNS server will then translate the name to the Ip and hence
                    the actual IP is no longer important.

                    • It will be hosted on the same port?

                    Yes unless you change it yourself, port remains the same.

                    Thank YouT 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      Hi

                      • Ok I made it work but Are there security risks in this situation(simple only) ?

                      Depends on what you did. if you allowed this port in the firewall on the internal network/pc
                      its ok. That's how one normally allows new traffic on a port.

                      • Will private IP change overtime.

                      Yes. if done by the local DHCP server then yes unless some IT dude promised you
                      it would not. You can be lucky that it will get the same IP for a long time.

                      • If so there will be problem because the database won't be hosted if IP changes.

                      well if the IP changes then the clients cant find the server anymore.

                      But I don't know your LAN. if it's not a home setup then you most likely also have a DNS server and that means you can use a name instead of an IP. the DNS server will then translate the name to the Ip and hence
                      the actual IP is no longer important.

                      • It will be hosted on the same port?

                      Yes unless you change it yourself, port remains the same.

                      Thank YouT Offline
                      Thank YouT Offline
                      Thank You
                      wrote on last edited by
                      #17

                      @mrjj

                      if it's not a home setup then you most likely also have a DNS server

                      It's home server. A router that we use for normal purpose.
                      With this I want to host this database to other users connected to the same router.

                      Let's make QT free or It will go forever

                      TRUE AND FALSE <3

                      jsulmJ mrjjM 2 Replies Last reply
                      0
                      • Thank YouT Thank You

                        @mrjj

                        if it's not a home setup then you most likely also have a DNS server

                        It's home server. A router that we use for normal purpose.
                        With this I want to host this database to other users connected to the same router.

                        jsulmJ Online
                        jsulmJ Online
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #18

                        @Thank-You said in How to connect database to online service:

                        A router that we use for normal purpose

                        Depending on the router you can assign static IPs to network devices.

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

                        1 Reply Last reply
                        1
                        • Thank YouT Thank You

                          @mrjj

                          if it's not a home setup then you most likely also have a DNS server

                          It's home server. A router that we use for normal purpose.
                          With this I want to host this database to other users connected to the same router.

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

                          It's home server. A router that we use for normal purpose.

                          Ok. you can most likely make it assign a fixed ip to the server so it never changes.
                          If it cant directly, you can often change the range of ips it will give out and
                          then use an ip outside of this range and hence keep it.

                          • With this I want to host this database to other users connected to the same router.

                          Wait ? from outside ? Like from the internet ?

                          Thank YouT 1 Reply Last reply
                          0
                          • Thank YouT Thank You

                            @mrjj
                            Yes, I actually got success after seeing this thing for almost day.

                               db.setDatabaseName("users");
                               db.setPort(9906);
                            // It  is 9906 because I changed from 3306 to 9906 before some time due to some errors
                               db.setHostName("192.168.100.4");
                               db.setUserName("host");
                               db.setPassword("");
                            

                            I first did what you said

                            changed to 9906(port)

                            And I got the error
                            322a9fd6-006e-401a-8c2e-4e15d0675ce2-image.png

                            Then I created new privileges to all address

                            Now It's finally done!

                            Ok I made it work but Are there security risks in this situation(simple only) ?
                            Another question for you

                            Will private IP change overtime.

                            If so there will be problem because the database won't be hosted if IP changes.
                            Am I right?. Or
                            It will be hosted on the same port?

                            SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #20

                            @Thank-You said in How to connect database to online service:

                            Then I created new privileges to all address

                            Depending on how you did that you allowed user from anywhere to connect to your database which might not be what you want.

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

                            Thank YouT 1 Reply Last reply
                            1
                            • SGaistS SGaist

                              @Thank-You said in How to connect database to online service:

                              Then I created new privileges to all address

                              Depending on how you did that you allowed user from anywhere to connect to your database which might not be what you want.

                              Thank YouT Offline
                              Thank YouT Offline
                              Thank You
                              wrote on last edited by
                              #21

                              @SGaist

                              PRIVILEGES ON *.* FROM 'host'@'%';
                              

                              It is shown while I was updating
                              I am sorry I did it with PHPMYADMIN So I don't know syntax much of this thing

                              CREATE USER 'demo'@'%' IDENTIFIED VIA mysql_native_password USING '***';
                              GRANT ALL PRIVILEGES ON *.* TO 'demo'@'%' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
                              GRANT ALL PRIVILEGES ON `users`.* TO 'demo'@'%'; 
                              

                              I recreated another one for showing.

                              Let's make QT free or It will go forever

                              TRUE AND FALSE <3

                              1 Reply Last reply
                              0
                              • mrjjM mrjj

                                It's home server. A router that we use for normal purpose.

                                Ok. you can most likely make it assign a fixed ip to the server so it never changes.
                                If it cant directly, you can often change the range of ips it will give out and
                                then use an ip outside of this range and hence keep it.

                                • With this I want to host this database to other users connected to the same router.

                                Wait ? from outside ? Like from the internet ?

                                Thank YouT Offline
                                Thank YouT Offline
                                Thank You
                                wrote on last edited by
                                #22

                                @mrjj said in How to connect database to online service:

                                Wait ? from outside ? Like from the internet ?

                                No, Just within the network only.
                                Like how you use WIFI. (Available to only peoples in the LOCAL NETWORK)

                                If you didn't understand this,
                                Let me give an example

                                Suppose I am connected to the WIFI(router). And you are also connected to the same wifi. I have hosted the database. You can use this database only if you are connected to the same wifi/router that I have hosted into. You are not allowed to access this outside of this network. If you get disconnected with network I won't be able to connect with it.

                                I hope you understands

                                Let's make QT free or It will go forever

                                TRUE AND FALSE <3

                                mrjjM 1 Reply Last reply
                                0
                                • Thank YouT Thank You

                                  @mrjj said in How to connect database to online service:

                                  Wait ? from outside ? Like from the internet ?

                                  No, Just within the network only.
                                  Like how you use WIFI. (Available to only peoples in the LOCAL NETWORK)

                                  If you didn't understand this,
                                  Let me give an example

                                  Suppose I am connected to the WIFI(router). And you are also connected to the same wifi. I have hosted the database. You can use this database only if you are connected to the same wifi/router that I have hosted into. You are not allowed to access this outside of this network. If you get disconnected with network I won't be able to connect with it.

                                  I hope you understands

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

                                  @Thank-You
                                  Ah
                                  Ok super. That will work fine then.
                                  Yes I understand fully :)

                                  If you know the 10 clients pc. you can take their mac address and
                                  tell the router to only allow those MAC addresses to the MySQL port.
                                  That will block all others-

                                  Thank YouT 2 Replies Last reply
                                  1
                                  • mrjjM mrjj

                                    @Thank-You
                                    Ah
                                    Ok super. That will work fine then.
                                    Yes I understand fully :)

                                    If you know the 10 clients pc. you can take their mac address and
                                    tell the router to only allow those MAC addresses to the MySQL port.
                                    That will block all others-

                                    Thank YouT Offline
                                    Thank YouT Offline
                                    Thank You
                                    wrote on last edited by
                                    #24

                                    @mrjj

                                    well if the IP changes then the clients cant find the server anymore.

                                    As you said this, So I allowed every IP. It can change at anytime

                                    72a3c95b-d3f1-4d7c-b2c0-c4cf034b836a-image.png

                                    tell the router to only allow those MAC addresses to the MySQL port.

                                    I didn't found any place to write MAC address here.

                                    Some people on the network (other that people accessing the database can still access the internet and any things)

                                    OR
                                    Do you mean to block other MAC address(other than 10)

                                    Let's make QT free or It will go forever

                                    TRUE AND FALSE <3

                                    1 Reply Last reply
                                    0
                                    • mrjjM mrjj

                                      @Thank-You
                                      Ah
                                      Ok super. That will work fine then.
                                      Yes I understand fully :)

                                      If you know the 10 clients pc. you can take their mac address and
                                      tell the router to only allow those MAC addresses to the MySQL port.
                                      That will block all others-

                                      Thank YouT Offline
                                      Thank YouT Offline
                                      Thank You
                                      wrote on last edited by
                                      #25

                                      @mrjj

                                      tell the router to only allow those MAC addresses to the MySQL port.

                                      Oh! maybe I didn't understand it.

                                      Do you mean giving access to certain mac address in ROUTER itself?

                                      Something like these
                                      https://www.snbforums.com/threads/how-to-restrict-open-port-access-to-certain-mac-addresses.7528/
                                      https://community.cisco.com/t5/switching/limit-ports-access-for-particular-mac-addresses-only/td-p/723845

                                      Let's make QT free or It will go forever

                                      TRUE AND FALSE <3

                                      mrjjM 1 Reply Last reply
                                      0
                                      • Thank YouT Thank You

                                        @mrjj

                                        tell the router to only allow those MAC addresses to the MySQL port.

                                        Oh! maybe I didn't understand it.

                                        Do you mean giving access to certain mac address in ROUTER itself?

                                        Something like these
                                        https://www.snbforums.com/threads/how-to-restrict-open-port-access-to-certain-mac-addresses.7528/
                                        https://community.cisco.com/t5/switching/limit-ports-access-for-particular-mac-addresses-only/td-p/723845

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

                                        @Thank-You
                                        Hi
                                        Yes in the router.
                                        so only the approved one can access the server. and not anyone on the same network.
                                        If it makes sense ofc.

                                        Thank YouT 1 Reply Last reply
                                        0
                                        • mrjjM mrjj

                                          @Thank-You
                                          Hi
                                          Yes in the router.
                                          so only the approved one can access the server. and not anyone on the same network.
                                          If it makes sense ofc.

                                          Thank YouT Offline
                                          Thank YouT Offline
                                          Thank You
                                          wrote on last edited by
                                          #27

                                          @mrjj
                                          If I use only one router I will do as you said
                                          I am thinking of using new router just for this purpose. And giving connection to only very specific device. So it will be faster and easier also.

                                          Let's make QT free or It will go forever

                                          TRUE AND FALSE <3

                                          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