HikariCP Help

Discussion in 'Spigot Plugin Development' started by Swedz, Jul 1, 2016.

  1. I am currently making a spigot plugin and I'm using just a DriverManager.getConnection() thing.. Which isn't the most efficient. I am only creating the connection in onEnable() and closing it in onDisable().

    But I'd like to convert over to HikariCP. But when I put the Hikari download into my build path, it shows no errors in Eclipse. But however I get a NoClassDefFoundError in my console on my server with the plugin.

    I've heard I need to use Maven in order to use Hikari, but I have no idea how to do Maven with Eclipse. I've tried just making a pom.xml in my src folder and outside of my src folder. Can someone please give me a clear and detailed explanation on what I must do to use Hikari in my spigot plugin?

    Also, I'm not sure if Hikari should fix this issue, but I've been having an issue with MySQL connections via. Java recently. It is still unsolved and I am wondering if switching to Hikari will solve this issue for me.
     
  2. I've solved this issue here on my own, apparently I was using an outdated way to connect to my MySQL connection. Now I am currently using a MysqlDataSource instead of a DriverManager.getConnection(). Which better suits my needs for this.

    However, I am still wanting to look into Hikari at some point.
     
  3. FormallyMyles

    Supporter

    Unfortunately this is a very interesting subject and not a lot of people use pooling. From experience if you're looking for an alternative I can suggest DBCP2. :)
     
  4. I've looked into DBCP2 before, would I have to do Maven for all that?
     
  5. FormallyMyles

    Supporter

    I believe they offer a bundle with all the libraries. From experience Eclipse lacks with maven and it's one of the reason I switched to IntelliJ. :(
     
    • Agree Agree x 2
  6. Darn.. I'll look into IntelliJ, thanks!
     
  7. You can shade Hikari into your jar using Maven.
     
  8. FormallyMyles

    Supporter

    I'd suggest doing this ^^ if you don't shade in properly i've found in the past it can cause weird bugs.
     
  9. I used to be a big fan of DBCP2, but for a Bukkit plugin I just can't recommend it anymore. It's very industrial grade, and when you're only running a Bukkit plugin (which won't have too many connections), then Hikari is a much better choice. It's more lightweight, faster, and less industrial grade.

    But everyone is entitled to their own opinion :p
     
    • Like Like x 1