Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

What, in your own opinion, is the best way to Send/Receive or Write data to a database? (What method or type of database/file server would you use to store the data aswell as grant client-side permission to write to the data?

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.