Mineuniverse
Log in Register
Plugins

MampfMysql Api

MampfMysql Api
by _ForgeUser8928282
Download Claim this project
552 downloads
0 likes
Updated Jun 30, 2026
0 hypes
Developer Tools

This plugin is a library to use mysql-databases for bukkit plugins.

Features

  • connect to a mysql server/database
  • perform querys with and without return values
  • if the connection is closed it will reconnect automatically
  • mysql_real_escape_string function for better security

Javadoc:

*here*

Example

try
{
      mysql = new MySQL(Bukkit.getLogger(),  // logger
         "[ExamplePlugin] ", // prefix
         "localhost", // host
         3306, // port
         "minecraft", // db
         "root",  // user
         "" // pw);
      
      mysql.open();
      if (mysql.isOpen())  // Check if the Connection was successful
            mysql.query("CREATE TABLE IF NOT EXISTS `regionen` ( `id` varchar(20) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8;");         
      else 
            Bukkit.getLogger().severe("[ExamplePlugin] Can't create connection");
}

[...]


public static String getOwner(String region) { 
    try {
      ResultSet result = mysql.query("SELECT owner FROM region WHERE id = " + mysql.quote(region) + " LIMIT 1;");
      if (result != null) {
         while (result.next()) {
            return result.getString("besitzer");
         }
   }
   } catch (SQLException e) {
     Bukkit.getLogger().severe(e.getMessage());
   }
   return null;
}

Please report problems with this plugin!

V 0.1
MC 1.7.2, 1.5.2, 1.6.4
Beta 2013-06-17 Get

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