Use MariaDB JDBC URL for connections.

This commit is contained in:
MobiusDev
2018-09-09 13:22:57 +00:00
parent 286697e77e
commit b75a4227d7
45 changed files with 72 additions and 72 deletions

View File

@@ -37,8 +37,8 @@ LoginHost = 127.0.0.1
Driver = org.mariadb.jdbc.Driver
# Database URL
# Default: jdbc:mysql://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
URL = jdbc:mysql://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
# Default: jdbc:mariadb://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
URL = jdbc:mariadb://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
# Login - Mysql's user
Login = root

View File

@@ -48,8 +48,8 @@ ShowLicence = True
Driver = org.mariadb.jdbc.Driver
# Database URL
# Default: jdbc:mysql://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
URL = jdbc:mysql://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
# Default: jdbc:mariadb://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
URL = jdbc:mariadb://localhost/l2jmobiusc6?useUnicode=true&characterEncoding=utf-8&useSSL=false
# Parameters Databases - MYSQL
# Login - Mysql's user

View File

@@ -1369,7 +1369,7 @@ public final class Config
GAME_SERVER_LOGIN_HOST = serverSettings.getProperty("LoginHost", "127.0.0.1");
DATABASE_DRIVER = serverSettings.getProperty("Driver", "org.mariadb.jdbc.Driver");
DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/");
DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mariadb://localhost/");
DATABASE_LOGIN = serverSettings.getProperty("Login", "root");
DATABASE_PASSWORD = serverSettings.getProperty("Password", "");
@@ -3822,7 +3822,7 @@ public final class Config
EXTERNAL_HOSTNAME = serverSettings.getProperty("ExternalHostname", "localhost");
DATABASE_DRIVER = serverSettings.getProperty("Driver", "org.mariadb.jdbc.Driver");
DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mysql://localhost/l2jdb");
DATABASE_URL = serverSettings.getProperty("URL", "jdbc:mariadb://localhost/l2jdb");
DATABASE_LOGIN = serverSettings.getProperty("Login", "root");
DATABASE_PASSWORD = serverSettings.getProperty("Password", "");
DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));

View File

@@ -72,7 +72,7 @@ public class DatabaseBackup
final String mysqldumpPath = System.getProperty("os.name").toLowerCase().indexOf("win") >= 0 ? Config.MYSQL_BIN_PATH : "";
try
{
final Process process = Runtime.getRuntime().exec(mysqldumpPath + "mysqldump -u " + Config.DATABASE_LOGIN + (Config.DATABASE_PASSWORD.trim().isEmpty() ? "" : " -p" + Config.DATABASE_PASSWORD) + " " + Config.DATABASE_URL.replace("jdbc:mysql://", "").replaceAll(".*\\/|\\?.*", "") + " -r " + Config.BACKUP_PATH + (Server.serverMode == Server.MODE_GAMESERVER ? "game" : "login") + new SimpleDateFormat("_yyyy_MM_dd_HH_mm'.sql'").format(new Date()));
final Process process = Runtime.getRuntime().exec(mysqldumpPath + "mysqldump -u " + Config.DATABASE_LOGIN + (Config.DATABASE_PASSWORD.trim().isEmpty() ? "" : " -p" + Config.DATABASE_PASSWORD) + " " + Config.DATABASE_URL.replace("jdbc:mariadb://", "").replaceAll(".*\\/|\\?.*", "") + " -r " + Config.BACKUP_PATH + (Server.serverMode == Server.MODE_GAMESERVER ? "game" : "login") + new SimpleDateFormat("_yyyy_MM_dd_HH_mm'.sql'").format(new Date()));
process.waitFor();
}
catch (Exception e)

View File

@@ -36,7 +36,7 @@ public class MySqlConnect
try (Formatter form = new Formatter())
{
Class.forName("org.mariadb.jdbc.Driver").newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
final String formattedText = form.format("jdbc:mariadb://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password);
try (Statement s = con.createStatement())