I would highly suggest using Bukkit's plugin databases API instead of this plugin.


SQLibrary was taken over from alta189 by PatPeter. So far it has support for 13 databases, a factory, and one query builder.


First, add these elements to your pom.xml if you're using Maven:

  <name>Dakani Nexus Repo</name>


You should always save implementations to a superclass, unless that child class has more functionality. So, start off by creating your variable:

private Database sql;

Constructing your database object can be either hardcoded into the definition, or assigned in the method. The constructor does not automatically open the database connection so that it does not have to throw an SQLException (though this was considered for quite some time). Below are the constructors for the most popular databases: MySQL, SQLite, and H2.

sql = new MySQL(Logger.getLogger("Minecraft"), 
            "[MyPlugin] ", 
sql = new SQLite(Logger.getLogger("Minecraft"), 
             "[MyPlugin] ", 
sql = new H2(Logger.getLogger("Minecraft"), 
         "[MyPlugin] ", 

For SQLite and H2, the extension is optional but will default to ".db". For MySQL, the hostname and port number are optional, but will default to those values. Next, we need to open our database connection:

if (sql.open()) {
    // ...

If you know that your plugin will only use the database intermittently, you should check to see if it is open first:

if (!sql.isOpen()) {

If any errors occur while opening the database connection, they will print to console.

Supported Databases

  1. Firebird
  2. FrontBase
  3. DB2
  4. H2
  5. Informix
  6. Ingres
  7. MaxDB
  8. MicrosoftSQL
  9. MySQL
  10. Mongo
  11. mSQL
  12. Oracle
  13. Ovrimos
  14. PostgreSQL
  15. SQLite


  1. Download the jar.
  2. In Eclipse, go to Project Properties ==> Java Build Path ==> Add External Jar and add SQLibrary.jar.
  3. Tell your users to install SQLibrary.jar along with your plugin

Do not install from source!

If you install SQLibrary directly into your plugin, the following bad things will occur:

  1. You cannot run your plugin alongside SQLibrary.jar plugins. Bukkit will (usually) find the SQLibrary classes in your plugin first, and block the SQLibrary.jar dependency.
  2. You cannot run your plugin alongside other plugins using SQLibrary directly from source. Same issue.
  3. Updating will definitely cause these problems and cause you much pain.

Download SQLibrary from your plugin

You can now place this code in your plugin to download and load SQLibrary from your plugin at runtime:


Special Thanks

  • alta189, for starting this library.
  • Belphemur, for adding the first version of our factory package.
  • omwah, for adding Maven to SQLibrary.
  • moose51789, for adding Spout support.
  • Mitsugaru, for hosting our Maven repository, finding bugs, and making fixes.
  • max9403, for supplying the code to download SQLibrary at runtime.

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of unclemark unclemark Mar 11, 2016 at 06:44 UTC - 0 likes

    I'm using cclogger which requires sqlite but with 1.9 things seem broken. Internal error.

  • Avatar of games647 games647 Dec 16, 2015 at 16:26 UTC - 0 likes

    @Mitsugaru: Go

    No problem. I just wanted to notify you. Thank you very much.

    FastLogin Auto login cracked accounts if the player has a paid account
    ScoreboardStats Fast custom scoreboard + compatibility with other scoreboard plugins
    ChangeSkin Change your ingame skin
    LagMonitor Analyze your server performance
    Minecraft Database

  • Avatar of Mitsugaru Mitsugaru Dec 15, 2015 at 23:02 UTC - 0 likes

    @games647: Go

    Sorry, there was a restart by the host (Linode) for some planned upgrades. Just needed to start the service afterwards and it slipped my mind. It should be up now, sorry for the downtime.

    Jenkins | Trello Dev board | Website
    Visit the Trello board to see/vote/comment on my current todo list for all projects in real time.
    Mine-RP Operator BFAK:52950,9c92ea09892ae7395af1f98741fb8dd73aed386e0b40f81435281ce5eca68c7f

  • Avatar of games647 games647 Dec 15, 2015 at 13:16 UTC - 0 likes

    @PatPeter: Go

    Your repository is down. Could you restart it?

    Last edited Dec 15, 2015 by games647
  • Avatar of PatPeter PatPeter Jul 05, 2015 at 08:33 UTC - 0 likes

    @moose517: Go

    Do you have the JDBC driver for Mongo and have you placed it in the lib directory of your server? I was trying to get this plugin to do this (another reason I made it a plugin instead of a source package), but I don't believe I ever got it working.

  • Avatar of PatPeter PatPeter Jul 05, 2015 at 08:32 UTC - 0 likes

    @CraftBang: Go

    H2 is faster than SQLite. I know that for a fact. SQLite is a more universal format though.

  • Avatar of PatPeter PatPeter Jul 05, 2015 at 08:31 UTC - 0 likes

    @Razorax: Go

    If I could +1 your comment I would Razorax. Gave me quite a chuckle.

    I've done a lot of research into this Ebeans ORM that's built into Bukkit, and to be honest an ORM was what I wanted SQLibrary to become. You can see that in the query builders I had started to develop when I actively maintained this plugin.

    It is based on this research that I believe every Minecraft plugin developer should learn how JPA generation works (which will look very good on a resume as well) and use Ebeans for a database layer.

  • Avatar of Razorax Razorax Jun 29, 2015 at 09:53 UTC - 0 likes

    Who is the "I" in "I would highly suggest using Bukkit's plugin databases API instead of this plugin."? Is it a Bukkit Nazi Dev? Or is it the author/current maintainer of this plugin?

  • Avatar of SableDnah SableDnah Apr 30, 2015 at 16:07 UTC - 0 likes

    @julib5432112345: Go

    Why's it need one? It works fine on craftbukkit and spigot?

    "All this technology and it still takes forever to get anywhere" [ Donate ] [ Twitter ]

    Mob HealthLegendQuest
    Mob Health: Simple damage reporting.LegendQuest: Complete RPG plugin.
  • Avatar of julib5432112345 julib5432112345 Apr 30, 2015 at 16:00 UTC - 0 likes

    Why no update?


Date created
Aug 25, 2012
Last update
Jan 14, 2014
Development stage
  • enUS
Creative Commons — Attribution-NonCommercial-NoDerivs 3.0 Unported (CC BY-NC-ND 3.0)
Curse link
Reverse relationships
Recent files