ScottehBoeh Posted March 19, 2016 Posted March 19, 2016 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? Quote http://i.imgur.com/vmqyxTE.png[/img]
coolAlias Posted March 20, 2016 Posted March 20, 2016 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. Quote http://i.imgur.com/NdrFdld.png[/img]
jeffryfisher Posted March 20, 2016 Posted March 20, 2016 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. Quote 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.
Recommended Posts
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.