Заменил драйвер ораклов на марию, всё читает, всё работает, вот только с установкой бд траблы, и ни как не въеду че ей надо.
Умные люди подскажите. Он пишет что schema пустая, но на кой он ее вообще создает?
Умные люди подскажите. Он пишет что schema пустая, но на кой он ее вообще создает?
Код:
10:49:51 [main] INFO Reflections - Reflections took 233 ms to scan 2 urls, producing 86 keys and 277 values
10:49:51 [main] INFO ConfigLoader - Loading LoginConfig config.
10:49:52 [main] INFO LoginConfig - Cached 10 KeyPairs for RSA communication
10:49:52 [main] INFO LoginConfig - Stored 20 keys for Blowfish communication
10:49:52 [main] INFO ServerNamesConfigParser - Loaded 127 server names
10:49:52 [main] INFO HikariDataSource - HikariPool-1 - Started.
10:49:52 [main] INFO DatabaseFactory - Database connection working.
10:49:52 [main] INFO DatabaseInstaller - Installing tables in database.
10:49:52 [main] INFO VersionPrinter - Flyway 4.0 by Boxfuse
10:49:52 [main] INFO DbSupportFactory - Database: jdbc:mariadb://localhost:3306/auth?characterEncoding=utf-8 (MySQL 10.3)
10:49:53 [main] INFO DbMigrate - Current version of schema `auth`: 1
10:49:53 [main] INFO DbMigrate - Schema `auth` is up to date. No migration necessary.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.mmocore.authserver.AuthServer.<init>(AuthServer.java:37)
at org.mmocore.authserver.AuthServer.main(AuthServer.java:96)
Caused by: org.mmocore.commons.jdbchelper.JdbcException: Error running query:
SELECT server_id FROM gameservers
Error: (conn=65) Table 'auth.gameservers' doesn't exist
at org.mmocore.commons.jdbchelper.JdbcHelper.genericQuery(JdbcHelper.java:353)
at org.mmocore.commons.jdbchelper.JdbcHelper.query(JdbcHelper.java:1516)
at org.mmocore.authserver.database.dao.impl.GameServerDAO.load(GameServerDAO.java:30)
at org.mmocore.authserver.manager.GameServerManager.load(GameServerManager.java:34)
at org.mmocore.authserver.manager.GameServerManager.<init>(GameServerManager.java:25)
at org.mmocore.authserver.manager.GameServerManager.<clinit>(GameServerManager.java:19)
... 2 more
Caused by: java.sql.SQLSyntaxErrorException: (conn=65) Table 'auth.gameservers' doesn't exist
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:177)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:110)
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:228)
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:334)
at org.mariadb.jdbc.MariaDbStatement.executeQuery(MariaDbStatement.java:505)
at com.zaxxer.hikari.pool.ProxyStatement.executeQuery(ProxyStatement.java:111)
at com.zaxxer.hikari.pool.HikariProxyStatement.executeQuery(HikariProxyStatement.java)
at org.mmocore.commons.jdbchelpe
Код:
# ================================================================
# Настройки базы данных
# ================================================================
# Database connection settings.
dataSource.url = jdbc:mariadb://localhost:3306/auth?characterEncoding=utf-8
dataSource.user = root
dataSource.password = root
# This is the name of the DataSource class provided by the JDBC driver.
# Consult the documentation for your specific JDBC driver to get this class name.
dataSourceClassName = org.mariadb.jdbc.MySQLDataSource
# This property controls the maximum number of milliseconds that a client (that's you) will wait for a connection from the pool.
# If this time is exceeded without a connection becoming available, a SQLException will be thrown.
# 1000 ms is the minimum value. Default: 30000 (30 seconds)
connectionTimeout = 30000
# This property controls the maximum amount of time that a connection is allowed to sit idle in the pool.
# Whether a connection is retired as idle or not is subject to a maximum variation of +30 seconds,
# and average variation of +15 seconds. A connection will never be retired as idle before this timeout.
# A value of 0 means that idle connections are never removed from the pool.
# Default: 600000 (10 minutes)
idleTimeout = 600000
# This property controls the maximum lifetime of a connection in the pool.
# When a connection reaches this timeout it will be retired from the pool, subject to a maximum variation of +30 seconds.
# An in-use connection will never be retired, only when it is closed will it then be removed.
# We strongly recommend setting this value, and it should be at least 30 seconds less than any database-level connection timeout.
# A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the idleTimeout setting.
# Default: 1800000 (30 minutes)
maxLifetime = 1800000
# This property controls the maximum size that the pool is allowed to reach, including both idle and in-use connections.
# Basically this value will determine the maximum number of actual connections to the database backend.
# A reasonable value for this is best determined by your execution environment.
# When the pool reaches this size, and no idle connections are available,
# calls to getConnection() will block for up to connectionTimeout milliseconds before timing out.
maximumPoolSize = 10
# This property controls the amount of time that a connection can be out of the pool before a message is logged
# indicating a possible connection leak.
# A value of 0 means leak detection is disabled.
# Lowest acceptable value for enabling leak detection is 2000 (2 secs).
# Default: 0
leakDetectionThreshold = 3000
Код:
package org.mmocore.commons.database.installer;
import org.flywaydb.core.Flyway;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.sql.DataSource;
import java.nio.file.Path;
/**
* @author Java-man
*/
public final class DatabaseInstaller {
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseInstaller.class);
private DatabaseInstaller() {
}
public static void start(final DataSource dataSource, final Path databaseFilesDir) {
LOGGER.info("Installing tables in database.");
final Flyway flyway = new Flyway();
flyway.setValidateOnMigrate(false);
flyway.setBaselineOnMigrate(true);
flyway.setDataSource(dataSource);
flyway.setLocations("filesystem:" + databaseFilesDir);
flyway.migrate();
}
}
Последнее редактирование: