51 lines
1.8 KiB
Java
51 lines
1.8 KiB
Java
package de.softwarerat.modutils.Utils;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.DriverManager;
|
|
import java.sql.SQLException;
|
|
|
|
public class MySQL {
|
|
|
|
private static Connection con;
|
|
private static String Host;
|
|
private static int port;
|
|
private static String database;
|
|
private static String user;
|
|
private static String password;
|
|
|
|
public MySQL(String Host, int port, String database, String user, String password) {
|
|
MySQL.Host = Host;
|
|
MySQL.port = port;
|
|
MySQL.database = database;
|
|
MySQL.user = user;
|
|
MySQL.password = password;
|
|
connect();
|
|
}
|
|
|
|
public static void connect() {
|
|
try {
|
|
con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/ModUitls?autoRecconnect=true", "Bansystem", "GGoders0");
|
|
} catch (SQLException var1) {
|
|
System.out.println("SQL Disconeccted");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
System.out.println("SQL Error Connection unreachable");
|
|
}
|
|
|
|
}
|
|
|
|
public static Connection getConnection() {
|
|
return con;
|
|
}
|
|
}
|