Hi,
Haxe seem to offer some functions to connect to a database, but I can’t get it work…
var cnx = neko.db.Mysql.connect({
host : “localhost”,
port : 3306,
user : “root”,
pass : “”,
socket : null,
database : “MyBase”
});
// …
cnx.close();
I found this example on this page : http://old.haxe.org/doc/neko/mysql
I believe I must change the “neko.db.Mysql” with something else, but I can’t find what to use…
Hi
Looking at the code, you can see that these are functions of the Neko platform, not the functions of the Haxe language. As far as I know, this platform is not in Armory3D
I have no idea, I never used that library and just googled if there was something that looks like it might bring SQL support to Haxe. Try putting it into the Libraries folder of your project just like any other libraries.
A “server” layer is needed to work with the database: php, js …
The game will communicate with the server via url.
P.S. Maybe the code from here will help to access the url:
Packing (json), serialization and encryption.
As a result, the sending will be only an encrypted string, which will be visible, but changing it correctly is already difficult.
For what it’s worth, I don’t recommend trying to connect directly to a MySQL database from the client side of anything. Especially if you plan to have a lot of simultaneous users. It is almost always the best way to set up a traditional client/server architecture and to expect the server to make SQL requests as-needed to service its clients’ needs. The SQL server therefore has a moderate number of connections to deal with – one for each application-server instance, not one for each client they are communicating with. The application server is also thus in a good position to handle issues like concurrency that an SQL server is just not the best one to handle directly.