Hi all, I'm moving my database from my local machine to being hosted on a website. I got everything working just fine on the local machine, requests and changes and everything, but now I am having some trouble making it work with a website. Does anyone have any good tutorials or information on this? It seems to be a little more involved than just changing the address from the localhost address to the web address, but I can't find specific tutorials. All the ones I am finding right now all run with localhost.

I think I might have to use HTTP requests, but I am not very familiar with those since I have been running everything locally so far. I am having trouble finding tutorials that go into HTTP requests specifically for database work.

Does anyone have any tips on this transfer?

Edit: for extra info, the game is multi-player and all of the relevant database code is run server side. So I don't need to worry about players directly accessing the database.

    Toxe well so far there are no errors, because there is no code. Well, no code that works with a web based database. The local instance of the database runs just fine, but I am to the point where I want to move it off my local machine and onto an online service.

    The immediate trouble that I am seeing is that I can't just change the address of the database from "local address" to "web address". There are more steps to it and I'm not super familiar with them. I'm not really all that clear on which steps to take to have it be done properly in the first place.

    What information I can find is that Godot can't talk to a web based SQL database directly, it needs a middleman to do all the code work. This is what I am having a hard time finding, how to set up this middle man coding to get things connected and talking to one another. Which is why I'm hoping there is someone that does have some info I can use to make it happen.

    • Toxe replied to this.

      CorvaNocta all of the relevant database code is run server side

      If you're running the database code on the server side why would you need to communicate with the database via http?

        CorvaNocta The immediate trouble that I am seeing is that I can't just change the address of the database from "local address" to "web address".

        That is usually how it works though.

        CorvaNocta What information I can find is that Godot can't talk to a web based SQL database directly, it needs a middleman to do all the code work. This is what I am having a hard time finding, how to set up this middle man coding to get things connected and talking to one another. Which is why I'm hoping there is someone that does have some info I can use to make it happen.

        What you are probably thinking of is a database driver, which is a software that talks directly to the database using its own communication protocol. For example a MySQL driver can connect and talk to a MySQL database but not to Sqlite or a Microsoft SQL Server.

        What I would probably do (generally speaking, not knowing what you actually want to do or achieve):

        • Run the DB server on your remote server.
        • Do not open the DB server for connections from the outside. Never ever do this unless you have to and know what you are doing.
        • Write a REST API server in Python that connects to the DB server and handles all the database communication.
        • Open this Python server for communication from the outside.
        • Send HTTP(S) requests from Godot to the Python server.

        Note that your Godot game/app does not need to "speak MySQL/MariaDB or Sqlite" or any other database dialect. Instead it just sends simple HTTP(S) requests to a REST API server and is completely database agnostic.

        As for the REST API server: It's pretty easy to do with Python and Flask. I did that a couple of years ago, if you need a place to start:

        https://github.com/Toxe/python-flask-rest-jwt
        https://github.com/Toxe/gps-tracks

          Toxe That sounds like the process I'm looking to set up! I appreciate the projects to look at. I think I'm getting a handle on how the systems work, will have to do some testing later in the week to see if I can get it working.

          Thanks for the info!

          xyz web based database will allow me to access it much easier should I ever need to fix or monitor the database. Running it locally with the server will make it an absolute pain to do that.

          Plus, in the future if I ever want more than 1 server I won't want two different databases.

          • xyz replied to this.

            CorvaNocta What is a "web based database"?

            If you can connect to a localhost via your current client setup, you should be able to connect to a remote host as well. If you have a client running on a server that communicates with a database on the same server then this database is local to this client.

            The question is do you want to communicate to the remote database directly or have an intermediary client/script on the server that you communicate with via http and then that client communicates with the database, sorta like a regular website would function.