Need Help With A Command

Discussion in 'Plugin Development' started by CardingiSFun, Mar 20, 2016.

Thread Status:
Not open for further replies.
  1. Offline


    So right now, Im trying to code a command that will write the data after it to a mysql database.

    I have the mysql database i just dont know how id push the command to the mysql database.
    Im doing a admin report command ex: /report MCNameHere Was Hacking
    I would like if the mcname was put in a part of table then the description..

    Please help?

  2. Zombie_Striker likes this.
  3. Offline


    Why do you need to use databases again? Except the fact the feature "Mysql support" sounds cool for inexperienced people.
    Zombie_Striker likes this.
  4. Offline


    I already coded the mysql database part. I can easily connect to it. I just dont know how to take it from a command and upload it to a mysql table.
  5. Offline


    I do not recommend MySQL, use textfile instead. It's faster than opening a MySQL connection, I tested it.
  6. Offline


    There is no reason to use MySQL databases unless you want multiple servers on multiple computers on separate routers. As McDorli said, it the main draw for MySQL is "cuz it sounds cool".

    From what you posted, it ssounds like you do not fully understand MySQL, nor does your plugin sound like it need mySQL. Best advice for you, use Text files. They're easier to manage, faster to read and takes up less memory.
  7. Offline


    Well im trying to code a plugin to for my admins to make a ban/kick/mute report when they do such, but i want it to store in our MySQL database to integrate it into our website we have for it. Ive coded plugins before just not using mysql so im new to it. I will admit. @Zombie_Striker
  8. Zombie_Striker likes this.
  9. Offline


    What im trying to say is i dont know how id take the data from the command then input it into the database.
  10. Offline


    The data is currently stored in th args array, I'm not experienced with MySQL (because in my opinion, it shoulfn't be used), so I can't give tips about the secobd stage
  11. Offline

    I Al Istannen


    Depends on the layout of your table. You can toy a bit with the MySQLWorkbench on a local copy, and then just use the commands in the Java plugin.

    If you have a Connection, you can use one of the prepareStatement methods, to create the statement and execute the Insert statement into the database. You can use the statement you got from above with that, but PLEASE don't simply append the user input in your statement. Use the setter methods from PreparedStatement, otherwise the user may blow up your database (here, or here).
    For the basic syntax of SQL, you use google and some time :)

    I am not that familiar with SQL either, so correct me if something is wrong or inefficient/discouraged.
Thread Status:
Not open for further replies.

Share This Page