Can't connect to phpMyAdmin

Discussion in 'Spigot Plugin Development' started by Sletonn, Apr 22, 2019.

  1. So I was testing a part of a big project code but when I'm trying to establish a connection between my plugin and phpMyAdmin nothing's happenning. Like litterally nothing no erros just this :

    Check at the time :
    Code (Text):
    public class ConnectionBuilder {
        private String host, user, password, databaseName;
        private int port;
        public ConnectionBuilder(String host, String user, String password, String databaseName, int port) {
   = host;
            this.user = user;
            this.password = password;
            this.databaseName = databaseName;
            this.port = port;
        public String getURL() {
            return new StringBuilder()

        public String getHost() {
            return host;

        public String getUser() {
            return user;

        public String getPassword() {
            return password;

        public String getDatabaseName() {
            return databaseName;

        public int getPort() {
            return port;

    Code (Text):
        TEST(new ConnectionBuilder("localhost", "Jules", "password", "test", 81));
        private DatabaseConnecter databaseConnector;

        private Database(ConnectionBuilder connectionBuilder) {
            this.databaseConnector = new DatabaseConnecter(connectionBuilder);

        public void initConnectionPool() {
              try {
                connection = DriverManager.getConnection(connectionBuilder.getURL(), connectionBuilder.getHost(), connectionBuilder.getPassword());
            } catch (SQLException | ClassNotFoundException e) {
                // TODO Auto-generated catch block

    I don't understand at all why is nothing happenning

    I finally got an error :
    errror sql.png
  2. I'm confused, phpMyAdmin is an online database tool, you don't connect to it. You need to connect to MySQL on port 3306 but you are connecting on 81? I'm not sure what port that is.
  3. Problem fixed, I was uing the wrong port
  4. It was the port I had setup for Apache haha
  5. That's what I thought :p glad you got it sorted!
    • Like Like x 1
  6. I have another error though, I don't understand why my syntax is correct normally :
    [22:56:13 WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'most_uuid = 2941535451391147758 AND least_uuid = -7138619786107225087' at line 1
    [22:56:13 WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    [22:56:13 WARN]: at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    [22:56:13 WARN]: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    [22:56:13 WARN]: at java.lang.reflect.Constructor.newInstance(Unknown Source)
    [22:56:13 WARN]: at com.mysql.jdbc.Util.handleNewInstance(
    [22:56:13 WARN]: at com.mysql.jdbc.Util.getInstance(
    [22:56:13 WARN]: at com.mysql.jdbc.SQLError.createSQLException(
    [22:56:13 WARN]: at com.mysql.jdbc.MysqlIO.checkErrorPacket(
    [22:56:13 WARN]: at com.mysql.jdbc.MysqlIO.checkErrorPacket(
    [22:56:13 WARN]: at com.mysql.jdbc.MysqlIO.sendCommand(
    [22:56:13 WARN]: at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
    [22:56:13 WARN]: at com.mysql.jdbc.ConnectionImpl.execSQL(
    [22:56:13 WARN]: at com.mysql.jdbc.PreparedStatement.executeInternal(
    [22:56:13 WARN]: at com.mysql.jdbc.PreparedStatement.executeQuery(
    [22:56:13 WARN]: at com.sql.test.Main.initPlayer(
    [22:56:13 WARN]: at com.sql.test.Main.onBreak(
    [22:56:13 WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [22:56:13 WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    [22:56:13 WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    [22:56:13 WARN]: at java.lang.reflect.Method.invoke(Unknown Source)
    [22:56:13 WARN]: at$1.execute(
    [22:56:13 WARN]: at org.bukkit.plugin.RegisteredListener.callEvent(
    [22:56:13 WARN]: at org.bukkit.plugin.SimplePluginManager.fireEvent(
    [22:56:13 WARN]: at org.bukkit.plugin.SimplePluginManager.callEvent(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.PlayerInteractManager.breakBlock(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.PlayerInteractManager.dig(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.PlayerConnection.a(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.PacketPlayInBlockDig.a(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.PacketPlayInBlockDig.handle(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.NetworkManager.a(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.ServerConnection.c(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.v(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.DedicatedServer.v(
    [22:56:13 WARN]: at net.minecraft.server.v1_7_R4.MinecraftServer.u(
    [22:56:13 WARN]: at
    [22:56:13 WARN]: at

    Here's my request :
    Code (Text):
            try {
                Connection connection = Database.ONIMA.getDatabaseConnector().getConnection();
                PreparedStatement statement = connection.prepareStatement("SELECT * FROM players "
                        + "INNER JOIN cooldowns ON players.most_uuid = cooldowns.most_uuid AND players.least_uuid = cooldowns.least_uuid"
                        + "WHERE most_uuid = ? AND least_uuid = ?");
                statement.setLong(1, uuid.getMostSignificantBits());
                statement.setLong(2, uuid.getLeastSignificantBits());

                ResultSet resultSet = statement.getResultSet();

    And here are my tables :

    Do you knnow why ? Thanks
    • Funny Funny x 1
  7. Between "least_uuid" and "WHERE" you have forgotten a space
    • Like Like x 1
    • Agree Agree x 1

Share This Page