mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Closes #1750
This commit is contained in:
parent
097159d606
commit
7e2a911530
@ -1,6 +1,9 @@
|
|||||||
package com.intellectualcrafters.plot.config;
|
package com.intellectualcrafters.plot.config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Storage extends Config {
|
public class Storage extends Config {
|
||||||
|
|
||||||
@ -23,6 +26,9 @@ public class Storage extends Config {
|
|||||||
public static String USER = "root";
|
public static String USER = "root";
|
||||||
public static String PASSWORD = "password";
|
public static String PASSWORD = "password";
|
||||||
public static String DATABASE = "plot_db";
|
public static String DATABASE = "plot_db";
|
||||||
|
|
||||||
|
@Comment("Set additional properties: https://goo.gl/wngtN8")
|
||||||
|
public static List<String> PROPERTIES = new ArrayList<>(Collections.singletonList("useSSL=false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Comment("SQLite section")
|
@Comment("SQLite section")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.intellectualcrafters.plot.database;
|
package com.intellectualcrafters.plot.database;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.config.Storage;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -45,7 +45,7 @@ public class MySQL extends Database {
|
|||||||
public Connection forceConnection() throws SQLException, ClassNotFoundException {
|
public Connection forceConnection() throws SQLException, ClassNotFoundException {
|
||||||
Class.forName("com.mysql.jdbc.Driver");
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
this.connection =
|
this.connection =
|
||||||
DriverManager.getConnection("jdbc:mysql://" + this.hostname + ':' + this.port + '/' + this.database + "?useSSL=false", this.user, this.password);
|
DriverManager.getConnection("jdbc:mysql://" + this.hostname + ':' + this.port + '/' + this.database + "?" + StringMan.join(Storage.MySQL.PROPERTIES, "&"), this.user, this.password);
|
||||||
return this.connection;
|
return this.connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,11 +54,7 @@ public class MySQL extends Database {
|
|||||||
if (checkConnection()) {
|
if (checkConnection()) {
|
||||||
return this.connection;
|
return this.connection;
|
||||||
}
|
}
|
||||||
Class.forName("com.mysql.jdbc.Driver");
|
return forceConnection();
|
||||||
PS.debug("jdbc:mysql://" + this.hostname + ':' + this.port + '/' + this.database + "?useSSL=false");
|
|
||||||
this.connection =
|
|
||||||
DriverManager.getConnection("jdbc:mysql://" + this.hostname + ':' + this.port + '/' + this.database + "?useSSL=false", this.user, this.password);
|
|
||||||
return this.connection;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user