Mineuniverse
Log in Register
Plugins

SQL API

MySQL API for Bukkit
by _ForgeUser11591311
Download Claim this project
790 downloads
0 likes
Updated Jun 30, 2026
0 hypes
Developer Tools

Ever needed to interact with a MySQL database but have no experience? Then this library is for you!

Connecting to a database

SQL sql = new SQL("database", "ip", "username", "password");

Setting the active table

sql.setTable("table name");

Executing statements

sql.execute(statement);

Statements

Select statement: get a value from the active table

// this example gets an integer from the database, in a table called Users where the username is Steve
SelectStatement<Integer> statement = new SelectStatement<Integer>("gems", new Clause("Username", "'Steve'"), 0);
int value = sql.execute(statement);

UpdateStatement: update a column value in a table

// this example sets the integer in the Users table for when the Username is Steve
UpdateStatement statement = new UpdateStatement(new Clause("Username", "'Steve'"), new Clause("gems", "100", "SET"));
sql.execute(statement);

DeleteStatement: delete a row from the current table

// this example deletes the row where the Username is Steve
DeleteStatement statement = new DeleteStatement(new Clause("Username", "'Steve'"));
sql.execute(statement);

InsertStatement: insert a row into the current table

// this code inserts a record for the Username Steve with 100 gems
InsertStatement statement = new InsertStatement("'Steve', 100");
sql.execute(statement);

CountStatement: count the number of records with 100 gems

// this code counts the number of rows with 100 as the gems value
CountStatement statement = new CountStatement(new Clause("gems", "100"));
int number = sql.execute(statement);

ReadTableStatement: mainly for debugging, prints a given column value of every row in a table

// this example prints the all the usernames in the given table
ReadTableStatement statement = new ReadTableStatement("Username");
sql.execute(statement);

CreateTableStatement: create a table.

CreateTableStatement statement = new CreateTableStatement(new TableArgument("Username", "VARCHAR(18)", "UNIQUE NOT NULL"), new TableArgument("gems", "INT(255)"));
sql.execute(statement);

You can also create custom statements by implementing the Statement<T> interface.

SQL API v1
MC CB 1.7.9-R0.2
Release 2014-12-14 Get

More from _ForgeUser11591311

QuizMe
999
FullJoin
806
FindMe
771
SwearMe
664
ChatNet
607
All Log
595

You Might Also Like

WorldGuard Custom Flags
WorldGuard Custom Flags
97,851
HoloAPI
Advanced and powerful holographic displays
93,959
Minequery
Minequery
91,099
SQLibrary
SQLibrary aims to streamline driver wrappers in Java for every database engine
85,675
WolfyUtilities
Utils and APIs: Config, Language and Inventory API, Protection Utils: WorldGuard, LWC, PlotSquared
84,728
DisguiseTester
Experiment with disguises!
9,677