So you can have the server with MySQL using standard web tools. Godot can communicate over HTTP, so you could use PHP, for example, with MySQL. You can also communicate with sockets, but this is low level and not needed. Depending on what you are doing, you can use Godot as the server on a Linux machine. This is useful for multiplayer games. But for straight database access, using HTTP will be the easiest.

https://docs.godotengine.org/en/stable/tutorials/networking/http_request_class.html

    Pixophir
    Ha ok thx https://godotengine.org/article/introducing-gd-extensions
    Until now, i just had a texture scaling glitch kinda. I didn't do much yet but my project isn't retro-compatible already, i will see how it goes.

    cybereality
    Yes, i just need the server to access the data base. I'm not really familiar with HTTP request or PHP, i will read more about it thx.

    edit: just found this https://www.raghwendra.com/blog/how-to-connect-html-to-database-with-mysql-using-php-example/

    If you want to run Godot on a headless server (Linux server) you can use C++. If you already have C++ code, you can turn it into a module (Godot add-on or extension). It is called GDNative. However, I still think it will be easier with PHP.

      cybereality
      It shouldn't be that hard with C++, you have the little library that allow you to access the db (i'm looking into other options atm SOCI, LiteSQL, qtl,...) so you get the infos you need, pass it into a string and then send it to the client with ENet. I did it before but i'm a bit lost after a few years without prog, it's like the easy-to-use libraries i was using before disappeared magically so the net can offer me all kind of shit-to-link-and-compile -without-tutos libraries wth? lol

      The problem i see with HTTP request/PHP is that it need an intermediate right?
      Server->PHP->Database
      while i just need to do Server->Database.

      I'm still looking into things, i will post again later if i make any progress, find a fitting solution for me, if i have more questions or whatever.

      Thanks for all your answers.

      What exactly is the use case? Is this a game or some sort of app? Do you have a client and server already in place (meaning there are two apps)? I assume the client must be in Godot, but what is the server running on?

      @cybereality : I understand they have a XAMPP stack running against which to perform database queries. So I reckon both versions would work from a Godot pov, that is performing http-requests against the patchy server, or with C++ and the database's API.

      The first would then be your suggestion to script https requests in Godot without doing a module or extension, the second making a C++ module (Godot 3.x) or extension (Godot 4.y).

      Hope that wasn't totally nonsensical :-)

      Yes, it's like that.
      I have a XAMPP server with a mysql database.
      For the time being the server will be a windows console app but yeah it could be on linux later.
      I didn't do much yet, there are things that i'm still designing so it's more about having the best tools that will let me do anything i want the simplest way possible.

      XAMPP is a PHP environment, so it would make sense to use that.

        cybereality
        I don't know, i'm still trying different tools, i will maybe use postgresql but it's like, for the past few years, the number of dependencies for all libraries multiplied by 10 and even if you get to compile, it's possible that you have some .dll missing for a simple console app that say "hello world!"... ><

        to be continued....

        Let me ask, what are you actually trying to achieve ?

        Maybe there's an easier way than all that heap of stuff.

          Pixophir

          The main goal here is to have: Clients (godot 4) <-> Server (whatever)<-> Database (whatever) and i just want to keep it as simple as possible.
          The client should portable to android later.

            Yeah, I got that.

            Is it a game ?
            Why the server(whatever, http ?) ?
            Why the database(whatever) ?
            What kind of requests and how frequently do you issue to the database ?
            What kind of data is stored there, and how much to merit a database ?

              Pixophir

              Yes, it is a game.
              By "whatever", i mean any database, through it should be a relational database for players infos, characters infos, inventories, monsters, usual stuff in online games kinda.
              I didn't even designed the whole thing, i just wanted to get started with the basic movement of the player.

              The player is in a maze represented by a table in the database, similar to a tilemap kinda.
              I sent a request to get the type of tile and its angle depending on the coordinates of the player in the maze, i sent back the info to the client that generate the (3D) tile ingame.
              Basically the world around the player is generated (and deleted) as he journey through it, but it is still a persistent world and the maze isn't procedurally generated.
              I won't use physic, collision or fancy stuff, i don't think it would be a lot of requests relatively speaking but the server-side will requires more work because of the persistent world.

              I made some progress but i'm a bit stuck with Godot.

              I was a able to get my little c++ server to connect to the postgresql database and if i'm not wrong, it initialize an ENet server on my localhost (ENET_HOST_ANY) on port 1234 and should be listening to incoming events.

              The problem is that there is no incoming events so it's hard to tell if my server is really online ^^;
              I suppose i need to use something like that:

              var enet_p = ENetPacketPeer.new()
              enet_p.connect_to_host("127.0.0.1",1234,0,0)

              but i'm not really familiar with GDScript yet.
              How could i make a little script just to see if the client actually connect to the server?

              thx

              noals Hi, This module is compiled using scons.
              You have to setup the SCsub file with the path to you boost lib and the MySQL C++ connector lib.
              Than just compile the engine as you normally would.
              Anyway, I'm working on this module again.
              This module works on Linux, Windows, should work on Macos as well.
              Recently I was able to compile it for Android, but the whole connector needs to be compiled together.
              The connector also suports soquets and SSL.
              If you need any extra help, you can create a issue on githob reposity.

              noals You can use the module this way. It is able to connect with local or remote databases. Obviously you will still need to configure your Mysql server to accept remote connections.
              The advantages:
              You can have a godot server on the same machine as your XAMP and make connections with your clients using Enet, which uses UPD and is consequently is much faster than TCP.
              It is easy to setup the Enet network with Godot.
              You can pretect the your DB requiring SSL.
              PS: Never allow your clients to connect directly to the database.

                Cleber
                Sorry, i'm not using the module and i switched to posgresql.
                I have a working ENet server (tested with a c++ client) through i'm working on it, creating c++ classes/functions to get the infos i want from the database.

                My question here is if i can initialize a godot Enet client and connect it to my c++ server.
                I'm not really familiar with GDScript and i have a lot to do already, i will check some tutorials later about that if i ever do.
                To be honest, i'm thinking about giving up on godot and simply using a c++ game engine like urho3D to go on with my project.
                I will see later when i'm done working on my server and database.

                thx

                  noals It's 100% possible. Godot has a low level Enet API to handle it.
                  Check it out: https://docs.godotengine.org/en/latest/classes/class_enetconnection.html
                  Another issue you might want to consider, is that the Enet library doesn't support IPV6, however the Godot's devs has added this support to the mechanism, and some anothers features, like DTLS and data compression.
                  Read the docs, check some exemples. the work is simpler using Godot. I'm using Godot for some another aplications but games and I'm pretty glad with. There are many advantages in using Godot as a framework.

                    Cleber

                    thank you for the informations but then, i should i use another network library already?
                    And i will need to make a module for godot... ><;
                    yeah, i like godot, it's been usefull already and will still be but i'm not sure it will really fit my needs.
                    Bah one thing at a time, thx anyway.

                    in 18 years, by the time i finish my game, ipv4 will be obsolete already, damn lol

                      noals You can use Enet with no issues. The Enet lib used in Godot can work IPV6, DTLS and Compression and those features are very important in any internet aplication.
                      Implement this features by yourself is like reinvent the wheel.
                      Give me an overview of your project and maybe I can paint it better.