Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.justinh.kingdoms.ranks.sql;
- import java.sql.*;
- public class SqlConnector {
- private static Connection con;
- public SqlConnector(boolean status) {
- if(status) {
- try {
- openConnection();
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- try {
- con.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- public SqlConnector() {
- }
- public void openConnection() {
- try{
- Class.forName("com.mysql.jdbc.Driver");
- con = DriverManager.getConnection("jdbc:mysql://66.85.144.162/mcph598161","mcph598161","b16c3c20f1");
- }catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void closeConnection() {
- try {
- con.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public Connection getConnection() {
- return con;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement