Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.maschinenmc.lobby.mysql;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import org.bukkit.Bukkit;
- public class MySQL {
- private Connection connection;
- public static String host;
- public static String port;
- public static String database;
- public static String username;
- public static String password;
- public void mysqlSetup() {
- MySQLFile file = new MySQLFile();
- file.setStandart();
- file.readData();
- try {
- synchronized (this) {
- if(getConnection() != null && !getConnection().isClosed()) {
- return;
- }
- Class.forName("com.mysql.jdbc.Driver");
- setConnection(DriverManager.getConnection("jdbc:mysql://" + MySQL.host + ":" + MySQL.port + "/" + MySQL.database, MySQL.username, MySQL.password));
- Bukkit.getConsoleSender().sendMessage("MYSQL VERBUNDEN");
- }
- }catch(SQLException e) {
- e.printStackTrace();
- }catch(ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
- public Connection getConnection() {
- return connection;
- }
- public void setConnection(Connection connection) {
- this.connection = connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement