Jump to content

Best method for Saving/Loading/Writing SECURE data to a database? (Cloud, MySQL)


Recommended Posts

Posted

Might I recommend you ask this on StackOverflow or some Java support forum (or search 'accessing MySQL from Java' on Google)? It's not really related to Minecraft or Forge.

 

That said, you are opening up a whole can of worms as far as code complexity goes. What are you trying to accomplish by involving a database? Why would you allow clients to write to it? This sounds like the wrong approach to me.

Posted

I don't think you want the client side to even know that a DB exists. Let clients be user interfaces. Let the server be the data authority with its own proprietary data storage mechanism(s). Depending on what you're trying to do, you may find yourself defining and/or sending some custom data packets.

 

If you're going to implement a relational DB to store some of Minecraft's data on the server, then you need to look at the entire dataflow for NBT reads and writes, and then create something parallel to that. Depending on how many places you want to involve DB I/O, you might be able to hitchhike.

 

As for security, don't distribute any version of your mod that contains any DB connection parameters. Also, for good practice, you should assume that every data originating from a client has been hacked with an SQL injection attack. Sanitize all client data before concatenating into an SQL statement. Your Minecraft server should not connect to the DB via a DB user having admin privs. Instead, the connection parameters should involve a dedicated DB user having only enough DB privileges to perform the DB operations needed by your mod's code.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.