Не подключается к БД MySQL

117
27 декабря 2020, 10:00
  public static void connect() {
         try {
              Class.forName("com.mysql.jdbc.Driver");
              connection = (Connection) DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
          statement = (Statement) connection.createStatement(1004, 1008);
         } catch (Exception e) {
            ruDB.log.warning("[ruDB] No connection!");
            e.printStackTrace();
         }
  }

Ошибка:

[21:17:31] [Server thread/WARN]: [ruDB] Unable to establish a connection to MySQL database!
[21:17:31] [Server thread/WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown character set: 'utf8mb4'
[21:17:31] [Server thread/WARN]:    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[21:17:31] [Server thread/WARN]:    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[21:17:31] [Server thread/WARN]:    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[21:17:31] [Server thread/WARN]:    at java.lang.reflect.Constructor.newInstance(Unknown Source)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.Util.getInstance(Util.java:382)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1890)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3523)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2386)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
[21:17:31] [Server thread/WARN]:    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[21:17:31] [Server thread/WARN]:    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[21:17:31] [Server thread/WARN]:    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[21:17:31] [Server thread/WARN]:    at java.lang.reflect.Constructor.newInstance(Unknown Source)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
[21:17:31] [Server thread/WARN]:    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
[21:17:31] [Server thread/WARN]:    at java.sql.DriverManager.getConnection(Unknown Source)
[21:17:31] [Server thread/WARN]:    at java.sql.DriverManager.getConnection(Unknown Source)
[21:17:31] [Server thread/WARN]:    at ru.lao.mysql.ruMySQL.connect(ruMySQL.java:35)
[21:17:31] [Server thread/WARN]:    at ru.lao.mysql.ruMySQL.<init>(ruMySQL.java:29)
[21:17:31] [Server thread/WARN]:    at ru.lao.mysql.ruDB.start(ruDB.java:20)
[21:17:31] [Server thread/WARN]:    at ru.lao.core.Main.onEnable(Main.java:532)
[21:17:31] [Server thread/WARN]:    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:316)
[21:17:31] [Server thread/WARN]:    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:368)
[21:17:31] [Server thread/WARN]:    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:410)
[21:17:31] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugin(CraftServer.java:415)
[21:17:31] [Server thread/WARN]:    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.enablePlugins(CraftServer.java:349)
[21:17:31] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.func_71243_i(MinecraftServer.java:500)
[21:17:31] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:474)
[21:17:31] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:434)
[21:17:31] [Server thread/WARN]:    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:329)
[21:17:31] [Server thread/WARN]:    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:620)
[21:17:31] [Server thread/WARN]:    at java.lang.Thread.run(Unknown Source)
READ ALSO
Android Как правильно реализовать PagerAdapter

Android Как правильно реализовать PagerAdapter

Делаю приложение - расписаниеИспользую MVP + Moxy

80
Как протестировать Spring веб-метод?

Как протестировать Spring веб-метод?

В этом методе происходит реверс слова с использованием рекурсии и без неё

104
Программа заходит в обе ветви if

Программа заходит в обе ветви if

Учу реактЕсть 2 файла (см

104