SQL and Configs

Discussion in 'Plugin Development' started by 1Achmed1, Sep 22, 2013.

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

    1Achmed1

    So, I was making a plugin using SQL today (using -_Husky_- 's tutorial), but I was unsure how to make the connection values configurable:
    Code:java
    1. MySQL MySQL = new MySQL(plugin, "host.name", "port", "database", "user", "pass");

    Just to be clear, the strings.
     
  2. Offline

    chasechocolate

  3. Offline

    1Achmed1

    chasechocolate Thanks :)
    I already knew about the Config API Reference, just not setting the values :D

    EDIT: That had me change it to
    public MySQL(Plugin plugin, String hostname, int port2, String database, String username, String password) {
    super(plugin);
    this.hostname = hostname;
    this.port = port2;
    this.database = database;
    this.user = username;
    this.password = password;
    this.connection = null;
    }
     
  4. Offline

    -_Husky_-

    The port needs to be a string, so instead of using getInt(), use getString().
     
  5. Offline

    1Achmed1

    And other than that it's all good?
     
  6. Offline

    -_Husky_-

    Yep.
     
  7. Offline

    1Achmed1

    Thanks, and I just realized that last code was in MySQL.java xD
     
Thread Status:
Not open for further replies.

Share This Page