Error - MySQL - DBLib

Discussion in 'Nukkit discussions and help' started by JackboyPlay, 1/12/16.

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
We welcome you on our site. This site is devoted to the Nukkit project and all that is connected with him. Here you can communicate, download plugins, also many other things get acquainted! Register the account right now :3
  1. JackboyPlay

    JackboyPlay Пользователь

    Messages:
    19
    Likes Received:
    1
    Minecraft:
    JackboyPlay
    Hello, If I want to check if a player is in the database "registered" I'll get an error:
    Code:
    13:51:30 [CRITICAL] "Could not pass event 'cn.nukkit.event.player.PlayerJoinEvent' to 'JCLoginSystem v1.0': null on me.JackboyPlay.Listener.PlayerJoin
    13:51:30 [ALERT] cn.nukkit.utils.EventException
    at cn.nukkit.plugin.MethodEventExecutor.execute(MethodEventExecutor.java:34)
    at cn.nukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:56)
    at cn.nukkit.plugin.PluginManager.callEvent(PluginManager.java:557)
    at cn.nukkit.Player.doFirstSpawn(Player.java:770)
    at cn.nukkit.Player.sendNextChunk(Player.java:725)
    at cn.nukkit.Player.checkNetwork(Player.java:1565)
    at cn.nukkit.Server.tick(Server.java:996)
    at cn.nukkit.Server.tickProcessor(Server.java:789)
    at cn.nukkit.Server.start(Server.java:768)
    at cn.nukkit.Server.<init>(Server.java:459)
    at cn.nukkit.Nukkit.main(Nukkit.java:65)
    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'jackboyplay' in 'where clause'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    at com.mysql.jdbc.Util.getInstance(Util.java:387)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
    at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)
    at me.JackboyPlay.JCLogin.JCLogin.loginPlayer(JCLogin.java:125)
    at me.JackboyPlay.Listener.PlayerJoin.onJoin(PlayerJoin.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at cn.nukkit.plugin.MethodEventExecutor.execute(MethodEventExecutor.java:29)
    ... 10 more
    
    My code:
    PHP:
    123 | @SuppressWarnings("deprecation")
    124 |   public static boolean loginPlayer(Player playerthrows NumberFormatExceptionSQLException{
    125 |      ResultSet rs MySQL.getConnection().createStatement().executeQuery("SELECT * FROM login WHERE name = " player.getName().toLowerCase());
    126 |      if(rs.next()){
    127 |           if(player.getClientId() == Long.parseLong(rs.getString("cid")) && player.getAddress() == rs.getString("ip")){
    128 |              return true;
    129 |           }
    130 |      }
    131 |       return false;
    132 |   }
     
  2. JackboyPlay

    JackboyPlay Пользователь

    Messages:
    19
    Likes Received:
    1
    Minecraft:
    JackboyPlay
    No one can help me?
     
  3. fromgate

    fromgate Administrator

    Messages:
    681
    Likes Received:
    194
    Something wrong with you query (Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'jackboyplay' in 'where clause').
    I recommend you to check your queries using MySQL Workbench or PHP MyAdmin.
     
    JackboyPlay likes this.
  4. fromgate

    fromgate Administrator

    Messages:
    681
    Likes Received:
    194
    What is on 125'th line of JCLogin class?
    Code:
    at me.JackboyPlay.JCLogin.JCLogin.loginPlayer(JCLogin.java:125)
     
    JackboyPlay likes this.
  5. JackboyPlay

    JackboyPlay Пользователь

    Messages:
    19
    Likes Received:
    1
    Minecraft:
    JackboyPlay
    Look at my post I've wrote the linenumbers behind the codeline :)
     
  6. JackboyPlay

    JackboyPlay Пользователь

    Messages:
    19
    Likes Received:
    1
    Minecraft:
    JackboyPlay
    I generated a query with phpmyadmin and it works now fine thank you really really much for your help!
     
    fromgate likes this.

Share This Page