MySQL Approach?

Pretty much new to development (C#) and was wondering what approach I should take when considering storing/reading data (from a database) from/to the client. Should I establish a MySQL connection on every client? or once on the server and use events to manipulate data from/to the client afterwards?

I personally get all the data from the client once he logs in to the server and after that I don’t touch MySQL again until he leaves the server. But im also learning

1 Like

NEVER! NEVER EVER USE A SQL CONNECTION ON CLIENT SIDE!

It could cause problems if the .net.dll get dumped and decrypted. The Person would then have your database connection datas.(password …)

Just use events to share/send the datas (serversided sql connection).

1 Like

Yeah just wanted some info on what other people think

Never knew that, I appreciate it, thanks!

Edit: Was wondering if you can request the database login info through events and then establish a connection? Is that also a no-no?

If you mean that:
to establish the connection you need to use the playerConnection server side event.

but if you need it client sided heres an example:

// here client code:

TriggerServerEvent("login", "username", "password");


(event="loginsuccess")

stuff here


// server

(event ="login")

check the stuff  trought the Database Connection (username,password) then trigger loginsuccess