Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

  1. #1
    Membre à l'essai
    "Before start of result set" et je n'arrive pas a savoir pourquoi.
    Bonjour,
    je suis entrain de développer le système de sauvegarde de mon bot discord mais je bloque cette erreur s'affiche et j'ai beau chercher je ne trouve pas la solution a mon problème.
    Code :
    Code :Sélectionner tout -Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
        public void createPlayer(String id, String name, int start_class) {
            PreparedStatement stm;
            try {
                stm = connection.prepareStatement("INSERT INTO rpg_bot (id, name, health, max_health, level, xp, coins, stone, iron, copper, fish, wood, farming, to_claim, ressources_to_claim_stone, ressources_to_claim_iron, ressources_to_claim_copper, ressources_to_claim_fish, ressources_to_claim_wood, farm_number, farm_seconds, lang, classe_id, classe_rank, weapon_id, armor_rank, map_x, map_y) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
                stm.setString(1, id);
                stm.setString(2, name);
                stm.setInt(3, 0);
                stm.setInt(4, 20);
                stm.setInt(5, 0);
                stm.setInt(6, 0);
                stm.setInt(7, 0);
                stm.setInt(8, 0);
                stm.setInt(9, 0);
                stm.setInt(10, 0);
                stm.setInt(11, 0);
                stm.setInt(12, 0);
                stm.setBoolean(13, false);
                stm.setBoolean(14, false);
                stm.setInt(15, 0);
                stm.setInt(16, 0);
                stm.setInt(17, 0);
                stm.setInt(18, 0);
                stm.setInt(19, 0);
                stm.setInt(20, 0);
                stm.setInt(21, 0);
                stm.setInt(22, 0);
                stm.setInt(23, start_class);
                stm.setInt(24, 0);
                stm.setInt(25, 0);
                stm.setInt(26, 0);
                stm.setInt(27, 0);
                stm.setInt(28, 0);
                stm.executeUpdate();
     
            } catch (SQLException e) {
                e.printStackTrace();
                Main.messageOwner();
            }
        }

    Erreur :
    Code :Sélectionner tout -Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    java.sql.SQLException: Before start of result set
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.checkRowPos(ResultSetImpl.java:484)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1283)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:786)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:807)
    	at fr.mateoox600.bot.SqlManager.getXp(SqlManager.java:189)
    	at fr.mateoox600.bot.players.PlayerData.refresh(PlayerData.java:29)
    	at fr.mateoox600.bot.players.PlayerData.<init>(PlayerData.java:24)
    	at fr.mateoox600.bot.commands.AccountCommand.execute(AccountCommand.java:30)
    	at com.jagrosh.jdautilities.command.Command.run(Command.java:325)
    	at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onMessageReceived(CommandClientImpl.java:557)
    	at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onEvent(CommandClientImpl.java:445)
    	at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
    	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:64)
    	at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:165)
    	at net.dv8tion.jda.internal.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:122)
    	at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:36)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:877)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:765)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:744)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:915)
    	at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
    	at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
    	at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
    	at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
    	at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    	at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    	at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

  2. #2
    Membre à l'essai
    Citation Envoyé par Mateoox600 Voir le message
    Bonjour,
    je suis entrain de développer le système de sauvegarde de mon bot discord mais je bloque cette erreur s'affiche et j'ai beau chercher je ne trouve pas la solution a mon problème.
    Code :
    Code :Sélectionner tout -Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
        public void createPlayer(String id, String name, int start_class) {
            PreparedStatement stm;
            try {
                stm = connection.prepareStatement("INSERT INTO rpg_bot (id, name, health, max_health, level, xp, coins, stone, iron, copper, fish, wood, farming, to_claim, ressources_to_claim_stone, ressources_to_claim_iron, ressources_to_claim_copper, ressources_to_claim_fish, ressources_to_claim_wood, farm_number, farm_seconds, lang, classe_id, classe_rank, weapon_id, armor_rank, map_x, map_y) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
                stm.setString(1, id);
                stm.setString(2, name);
                stm.setInt(3, 0);
                stm.setInt(4, 20);
                stm.setInt(5, 0);
                stm.setInt(6, 0);
                stm.setInt(7, 0);
                stm.setInt(8, 0);
                stm.setInt(9, 0);
                stm.setInt(10, 0);
                stm.setInt(11, 0);
                stm.setInt(12, 0);
                stm.setBoolean(13, false);
                stm.setBoolean(14, false);
                stm.setInt(15, 0);
                stm.setInt(16, 0);
                stm.setInt(17, 0);
                stm.setInt(18, 0);
                stm.setInt(19, 0);
                stm.setInt(20, 0);
                stm.setInt(21, 0);
                stm.setInt(22, 0);
                stm.setInt(23, start_class);
                stm.setInt(24, 0);
                stm.setInt(25, 0);
                stm.setInt(26, 0);
                stm.setInt(27, 0);
                stm.setInt(28, 0);
                stm.executeUpdate();
     
            } catch (SQLException e) {
                e.printStackTrace();
                Main.messageOwner();
            }
        }

    Erreur :
    Code :Sélectionner tout -Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    java.sql.SQLException: Before start of result set
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
    	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.checkRowPos(ResultSetImpl.java:484)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1283)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:786)
    	at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:807)
    	at fr.mateoox600.bot.SqlManager.getXp(SqlManager.java:189)
    	at fr.mateoox600.bot.players.PlayerData.refresh(PlayerData.java:29)
    	at fr.mateoox600.bot.players.PlayerData.<init>(PlayerData.java:24)
    	at fr.mateoox600.bot.commands.AccountCommand.execute(AccountCommand.java:30)
    	at com.jagrosh.jdautilities.command.Command.run(Command.java:325)
    	at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onMessageReceived(CommandClientImpl.java:557)
    	at com.jagrosh.jdautilities.command.impl.CommandClientImpl.onEvent(CommandClientImpl.java:445)
    	at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
    	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:64)
    	at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:165)
    	at net.dv8tion.jda.internal.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:122)
    	at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:36)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:877)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:765)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:744)
    	at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:915)
    	at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
    	at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
    	at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
    	at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
    	at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    	at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    	at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
    Résolut

  3. #3
    Modérateur

    L'erreur ne correspond pas au code que tu montres.

    Il faut regarder attentivement le stacktrace lié à l'exception, il te donne le nom de la méthode en erreur...
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java