Attention: This is no prepared statement example, you have to prevent against mysql injection by yourself
Some developers have asked me if I could help them with MySQL.
Here is my MySQL API for developers. You can find an example below.
Simply copy the .jar in your server folder and all your plugins are ready for the MySQL API.
Code-Example
Some developers have asked me if I could help them with MySQL.
Here is my MySQL API for developers. You can find an example below.
Simply copy the .jar in your server folder and all your plugins are ready for the MySQL API.
Code-Example
Code (Text):
import de.renickbuettner.forDevs.api.mysql.MySQL;
public class Example1 {
public void useMySQLAPI(){
MySQL con = new MySQL();
con.host = "localhost";
con.user = "root";
con.passwort = "root";
con.database = "minecraft-server";
con.connect();
if(con.countToBoolean("SELECT COUNT(player) FROM Players WHERE playername='sp33dy4ever'"))
System.out.println("Oh!!! You´ve a sp33dy :o");
con.disconnect();
}
}
public class Example1 {
public void useMySQLAPI(){
MySQL con = new MySQL();
con.host = "localhost";
con.user = "root";
con.passwort = "root";
con.database = "minecraft-server";
con.connect();
if(con.countToBoolean("SELECT COUNT(player) FROM Players WHERE playername='sp33dy4ever'"))
System.out.println("Oh!!! You´ve a sp33dy :o");
con.disconnect();
}
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
MySQL-API for Devs is a free Minecraft Java mod. Downloaded 855 times (via Spigot). Download it and open it directly in the game.