Solved What is the best way to connect to a MySQL database?

Discussion in 'Plugin Development' started by PumpMelon, Oct 23, 2016.

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

    PumpMelon

    Hey,
    Just wanted to get everyones thoughts on this. I know there are libraries on this, but is there on superior to everything else?
    What I have is two classes, one called MySQL and Database
    Database class
    http://hastebin.com/sutahinege.java
    MySQL class
    http://hastebin.com/edolabubuw.java

    Though I do not believe this is Asynchronous, I didn't make these classes I got them from a tutorial.
     
  2. Offline

    mythbusterma

    @PumpMelon

    I wouldn't call a single file that makes everything more cumbersome a "library," but suit yourself.

    The best way to do it is to open a connection to the server using the JDBC and use it. It's really that straightforward.

    Also, that code is pretty awful, and no it's not asynchronous.
     
    PumpMelon likes this.
  3. Offline

    PumpMelon

    @mythbusterma

    I was referring to Hikari and other things like that, and yeah thought that it wasn't good. I'll do as you said from now on, thanks.
     
  4. Offline

    mythbusterma

    @PumpMelon

    Ah okay, I tried Hikari, but I really don't feel that a plugin requires that kind of "firepower," per se. However, they do have some benefits, but some serious drawbacks too. It's up to you to decide if you want to use it.
     
Thread Status:
Not open for further replies.

Share This Page