Class MySQL
java.lang.Object
com.github.pinont.singularitylib.api.utils.MySQL
Utility class for managing MySQL database connections.
Provides functionality to connect to MySQL databases with automatic configuration setup.
-
Constructor Summary
ConstructorsConstructorDescriptionMySQL(org.bukkit.plugin.Plugin plugin) Default constructor for MySQL utility class. -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the database connection if it exists.Gets a connection to the database using the default config file.getConnection(String configPath) Gets a connection to the database using the specified config file.voidInitializes the database connection using the specified config file.
-
Constructor Details
-
MySQL
public MySQL(org.bukkit.plugin.Plugin plugin) Default constructor for MySQL utility class.
-
-
Method Details
-
getConnection
Gets a connection to the database using the default config file.- Returns:
- the database connection, or null if connection failed
-
getConnection
Gets a connection to the database using the specified config file.- Parameters:
configPath- the path to the configuration file- Returns:
- the database connection, or null if connection failed
-
init
Initializes the database connection using the specified config file.- Parameters:
configPath- the path to the configuration file
-
closeConnection
public void closeConnection()Closes the database connection if it exists.
-