Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dev.prettybytes.punishments.database;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import java.sql.Statement;
- import dev.prettybytes.punishments.PrettyPunishments;
- public class MySql {
- public static Connection connection;
- public static Statement statement;
- public static void doConnection(String host, String database, String user, String password) {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection("jdbc:mysql://" + host + "/" + database, user, password);
- statement = connection.createStatement();
- statement.execute("CREATE TABLE IF NOT EXISTS prettyPunishments (user VARCHAR(255) NOT NULL, staffer VARCHAR(255) NOT NULL, tipo VARCHAR(255) NOT NULL, motivo VARCHAR(255) NOT NULL, data VARCHAR(255) NOT NULL, expira VARCHAR(255) NOT NULL)");
- } catch (ClassNotFoundException|SQLException e) {
- e.printStackTrace();
- PrettyPunishments.errorStop("ER92");
- }
- }
- public static void undoConnection() {
- try {
- if(connection.isClosed()) return;
- statement.close();
- connection.close();
- } catch (SQLException e) {
- e.printStackTrace();
- PrettyPunishments.errorStop("ER92-A");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement