package jesse.keeblarcraft.ConfigMgr; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class SQLConfig { private static SQLConfig static_inst; public static SQLConfig GetInstance() { if (static_inst == null) { static_inst = new SQLConfig(); } return static_inst; } Connection conn = null; public SQLConfig() { Boolean canConnect = false; try { // According to some random online tutorial; this loads the driver! Class.forName("com.mysql.cj.jdbc.Driver"); canConnect = true; } catch (Exception e) { System.out.println("Could not find the proper SQL JDBC Drivers. Cannot connect to SQL Config"); e.printStackTrace(); } if (canConnect) { try { conn = DriverManager.getConnection("jdbc:mysql://localhost/keeblarcraft", "keeblarcraft", GeneralConfig.GetInstance().GetSQLPassword()); Statement stmnt = conn.createStatement(); String testSql = "SELECT * FROM test_table"; ResultSet rs = stmnt.executeQuery(testSql); System.out.println("Printing out result set from test query"); while (rs.next()) { System.out.println("[RS]: " + rs.getString("test_name")); } } catch (SQLException e) {} } } }