Class MySqlDatabase
java.lang.Object
org.sgrewritten.stargate.database.MySqlDatabase
- All Implemented Interfaces:
SQLDatabaseAPI
Represents a MySQL database
- Author:
- Frostalf, Thorin
-
Constructor Summary
ConstructorDescriptionMySqlDatabase
(org.bukkit.plugin.java.JavaPlugin plugin) Instantiates a new MySQL database connection using this stargate plugin instance's configMySqlDatabase
(DatabaseDriver driver, String address, int port, String database, String userName, String password, boolean useSSL) Instantiates a new MySQL database connection using the given values -
Method Summary
Modifier and TypeMethodDescriptionGets a database connection
-
Constructor Details
-
MySqlDatabase
public MySqlDatabase(DatabaseDriver driver, String address, int port, String database, String userName, String password, boolean useSSL) throws StargateInitializationException Instantiates a new MySQL database connection using the given values- Parameters:
driver
-The driver to use for this database communication
address
-The address of the MySQL server
port
-The port of the MySQL server
database
-The database to store Stargate tables in
userName
-The username to use when connecting to the database
password
-The password to use when connecting to the database
useSSL
-Whether or not to force the use of SSL for the connection
- Throws:
StargateInitializationException
-
MySqlDatabase
Instantiates a new MySQL database connection using this stargate plugin instance's config- Parameters:
plugin
-An instance of the Stargate plugin
- Throws:
SQLException
-If unable to setup a database connection
-
-
Method Details
-
getConnection
Description copied from interface:SQLDatabaseAPI
Gets a database connection- Specified by:
getConnection
in interfaceSQLDatabaseAPI
- Returns:
A database connection
- Throws:
SQLException
-If unable to establish a database connection
-
getDriver
- Specified by:
getDriver
in interfaceSQLDatabaseAPI
- Returns:
The driver this database is using
-