Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.jlpcrew.lobbyscoreboard;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class MySQL {
- public static String host = "localhost";
- public static String port = "3306";
- public static String database = "JLPCrew.net";
- public static String username = "root";
- public static String password = "2a7d85d2fba3";
- public static Connection con;
- public static void connect() {
- if(!isConnected()) {
- try {
- con = DriverManager.getConnection("jdbc:mysql://localhost:3306/JLPCrew.net?autoReconnect=true", "root", "2a7d85d2fba3");
- System.out.println("[LobbySystem - MySQL] Verbindung aufgebaut!");
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
- public static void disconnect() {
- if(isConnected()) {
- try {
- con.close();
- System.out.println("[LobbySystem - MySQL] Verbindung geschlossen!");
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
- public static boolean isConnected() {
- return(con == null ? false : true);
- }
- public static void createTable() {
- try {
- con.prepareStatement("CREATE TABLE IF NOT EXISTS PunkteSystem (UUID VARCHAR(100), Punkte INT(16))").executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement