Minecraft SQLibrary mod 2026 download
logo
minecraft mod SQLibrary

SQLibrary

Game Version: CB 1.7.2-R0.2
Total Downloads: 74,204
Updated: Jan 14, 2014
Created: Aug 25, 2012
Download SQLibraryDownload Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
SQLibrary 7.1 - Bukkit/Spout release 85.57 KB Jan 14, 2014 CB 1.7.2-R0.2 49,021 download SQLibrary SQLibrary 7.1 - Bukkit/Spout releaseDownload
SQLibrary 7.0 - Bukkit/Spout release 87.27 KB Dec 29, 2013 CB 1.7.2-R0.2 1,401 download SQLibrary SQLibrary 7.0 - Bukkit/Spout releaseDownload
SQLibrary 6.1 - Bukkit/Spout release 93.61 KB Oct 15, 2013 CB 1.6.2-R1.0 5,505 download SQLibrary SQLibrary 6.1 - Bukkit/Spout releaseDownload
SQLibrary 4.2 release 95.89 KB Feb 26, 2013 CB 1.4.7-R1.0 11,116 download SQLibrary SQLibrary 4.2 releaseDownload
SQLibrary 4.1 release 103.26 KB Feb 11, 2013 CB 1.4.7-R1.0 1,218 download SQLibrary SQLibrary 4.1 releaseDownload
SQLibrary 4.0 release 103.85 KB Dec 31, 2012 CB 1.4.6-R0.3 1,804 download SQLibrary SQLibrary 4.0 releaseDownload
SQLibrary 3.1 release 30.96 KB Sep 9, 2012 1.3.2 1,626 download SQLibrary SQLibrary 3.1 releaseDownload
SQLibrary 6.0 beta 97.17 KB Jul 8, 2013 1.6.1 2,513 download SQLibrary SQLibrary 6.0 betaDownload

Description

Share this:

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

SQLibrary

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

Tutorial

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

<repository>
  <id>dakani</id>
  <name>Dakani Nexus Repo</name>
  <url>http://repo.dakanilabs.com/content/repositories/public</url>
</repository>

<dependency>
  <groupId>lib.PatPeter.SQLibrary</groupId>
  <artifactId>SQLibrary</artifactId>
  <version>7.1</version>
</dependency>

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] ", 
            "localhost", 
            3306, 
            "myplugin", 
            "minecraft", 
            "password1");
sql = new SQLite(Logger.getLogger("Minecraft"), 
             "[MyPlugin] ", 
             this.getDataFolder().getAbsolutePath(), 
             "MyPlugin", 
             ".sqlite");
sql = new H2(Logger.getLogger("Minecraft"), 
         "[MyPlugin] ", 
         this.getDataFolder().getAbsolutePath(), 
         "MyPlugin", 
         ".h2");

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()) {
    sql.open();
}

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

Installation

  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:

http://dev.bukkit.org/bukkit-plugins/sqlibrary/pages/soft-dependency-download/

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.

Links

  • Go here to discuss SQLibrary!
  • Go here if you need help!
  • Go here to mention your plugin if you use SQLibrary with it!
  • Forum Thread

Comments

Add a comment