Solved MySQL Help

Discussion in 'Plugin Development' started by Wizehh, Jan 27, 2014.

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


    Typically you want to remove the need for that. Mysql#query() and MySQL()#update already exist for that reason, you usually want to make the methods individually that would handle that specific data.
  2. Offline



    Well, it seems as if the problem wasn't with the code :rolleyes: ; rather, it was Godaddy kicking me out for some security reasons. I've created a localhost MySQL server for temporary testing, and it works like a charm.
    Anways, thank you to all who helped!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 6, 2016
  3. Offline


    Wizehh I completely reserve myself the right to say, "Told you so".
  4. Offline


  5. Offline


    If anyone is still looking for a solution here is how it can be fixed:
    1. Create a scheduler that will update the static Connection variable every 500k ticks (~7 hours).
    2. Make sure that you access the Connection variable in a static manner (Ex: Plugin.connection.createStatement(); )
    2. public static Connection connection;
    4. void loadDatabase(){
    5. final MySQL MySQL = new MySQL(this, host, port, database, user, password);
    6. connection = MySQL.openConnection();
    8. //schedule reconnect
    9. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
    10. public void run(){
    11. connection = MySQL.openConnection();
    12. }
    13. }, 500000, 500000);
    14. }
Thread Status:
Not open for further replies.

Share This Page