Class MySQLConnectionPool
java.lang.Object
com.zetaplugins.lifestealz.storage.connectionPool.MySQLConnectionPool
- All Implemented Interfaces:
ConnectionPool
A MySQL connection pool that manages connections to a MySQL database.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a connection to the MySQL database from the connection pool.voidreleaseConnection(Connection connection) Releases a connection back to the MySQL connection pool.voidshutdown()Shuts down the MySQL connection pool and releases all resources.
-
Constructor Details
-
MySQLConnectionPool
public MySQLConnectionPool(String host, String port, String database, String username, String password) Constructs a MySQL connection pool with the specified host, port, database, username, and password.- Parameters:
host- the host of the MySQL databaseport- the port of the MySQL databasedatabase- the name of the MySQL databaseusername- the username to connect to the MySQL databasepassword- the password to connect to the MySQL database
-
-
Method Details
-
getConnection
Returns a connection to the MySQL database from the connection pool.- Specified by:
getConnectionin interfaceConnectionPool- Returns:
- a connection to the MySQL database
- Throws:
SQLException- if an error occurs while getting a connection
-
releaseConnection
Releases a connection back to the MySQL connection pool.- Specified by:
releaseConnectionin interfaceConnectionPool- Parameters:
connection- the connection to release- Throws:
SQLException- if an error occurs while releasing the connection
-
shutdown
public void shutdown()Shuts down the MySQL connection pool and releases all resources.- Specified by:
shutdownin interfaceConnectionPool
-